difit 4.0.4 → 4.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/README.ja.md +2 -2
  2. package/README.ko.md +2 -2
  3. package/README.md +2 -2
  4. package/README.zh.md +2 -2
  5. package/dist/cli/index.js +1 -1
  6. package/dist/cli/index.test.js +5 -5
  7. package/dist/client/assets/{index-RcU838Ah.js → index-BPoqJmrs.js} +18 -18
  8. package/dist/client/assets/prism-clojure-CTkJ-FW_.js +1 -0
  9. package/dist/client/index.html +1 -1
  10. package/package.json +4 -4
  11. /package/dist/client/assets/{prism-csharp-C1RDHXRk.js → prism-csharp-DAAROvjt.js} +0 -0
  12. /package/dist/client/assets/{prism-dart-nIH9vDUM.js → prism-dart-CMjMHaBW.js} +0 -0
  13. /package/dist/client/assets/{prism-elixir-DUMUOd7H.js → prism-elixir-B9cwzXs0.js} +0 -0
  14. /package/dist/client/assets/{prism-haskell-BP3SRvzt.js → prism-haskell-Vgx7BCAm.js} +0 -0
  15. /package/dist/client/assets/{prism-hcl-C-ZHJGEE.js → prism-hcl-Du4YC80h.js} +0 -0
  16. /package/dist/client/assets/{prism-java-scuShSv5.js → prism-java-CWuFbfVD.js} +0 -0
  17. /package/dist/client/assets/{prism-markup-templating-BFXREXfb.js → prism-markup-templating-h9TC-ifW.js} +0 -0
  18. /package/dist/client/assets/{prism-nix-CO4UPu3E.js → prism-nix-CqauNIYa.js} +0 -0
  19. /package/dist/client/assets/{prism-perl-BBDKnHRR.js → prism-perl-DhcRwJzx.js} +0 -0
  20. /package/dist/client/assets/{prism-php-DjIafOi_.js → prism-php-DcBIrISj.js} +0 -0
  21. /package/dist/client/assets/{prism-protobuf-BE1MoFmZ.js → prism-protobuf-DuPg7Jbg.js} +0 -0
  22. /package/dist/client/assets/{prism-ruby-CZ-lrXfL.js → prism-ruby-lhDmuasn.js} +0 -0
  23. /package/dist/client/assets/{prism-scala-DgnxHuDn.js → prism-scala-YlPat9I4.js} +0 -0
  24. /package/dist/client/assets/{prism-solidity-5fSUcW9Y.js → prism-solidity-C3nR0EVH.js} +0 -0
  25. /package/dist/client/assets/{prism-sql-CKkohPI_.js → prism-sql-Cz-8DmQS.js} +0 -0
  26. /package/dist/client/assets/{prism-vim-CkRmxTmK.js → prism-vim-C3oukvmk.js} +0 -0
@@ -11,7 +11,7 @@ Error generating stack: `+e.message+`
11
11
  `)?e:e+`
12
12
  `}\`\`\``}var Dt=2,Ot=100;function kt(e){return!(e.length<Dt||e.length>Ot)}function At(e){return e.toLowerCase()}function jt(e){let t=e.trim();return t?t.match(/^\w+$/)!==null&&kt(t):!1}var Mt=200,Nt=(0,A.createContext)(void 0);function Pt({children:e}){let[t,n]=(0,A.useState)(null),r=(0,A.useRef)(null),i=(0,A.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null)},[]),a=(0,A.useCallback)(e=>{let t=e.target;if(!t.classList.contains(`word-token`))return;i();let a=t.getAttribute(`data-word`);a&&(r.current=setTimeout(()=>{n(a)},Mt))},[i]),o=(0,A.useCallback)(()=>{i(),n(null)},[i]),s=(0,A.useCallback)(e=>t?At(e)===At(t):!1,[t]);(0,A.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let c=(0,A.useMemo)(()=>({highlightedWord:t,handleMouseOver:a,handleMouseOut:o,isWordHighlighted:s}),[t,a,o,s]);return(0,j.jsx)(Nt.Provider,{value:c,children:e})}function Ft(){let e=(0,A.useContext)(Nt);if(!e)throw Error(`useWordHighlight must be used within a WordHighlightProvider`);return e}function It(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=It(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Lt(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=It(e))&&(r&&(r+=` `),r+=t);return r}var Rt=Object.create,zt=Object.defineProperty,Bt=Object.defineProperties,Vt=Object.getOwnPropertyDescriptor,Ht=Object.getOwnPropertyDescriptors,Ut=Object.getOwnPropertyNames,Wt=Object.getOwnPropertySymbols,Gt=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable,Jt=(e,t,n)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yt=(e,t)=>{for(var n in t||={})Kt.call(t,n)&&Jt(e,n,t[n]);if(Wt)for(var n of Wt(t))qt.call(t,n)&&Jt(e,n,t[n]);return e},Xt=(e,t)=>Bt(e,Ht(t)),Zt=(e,t)=>{var n={};for(var r in e)Kt.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wt)for(var r of Wt(e))t.indexOf(r)<0&&qt.call(e,r)&&(n[r]=e[r]);return n},Qt=(e,t)=>function(){return t||(0,e[Ut(e)[0]])((t={exports:{}}).exports,t),t.exports},$t=(e,t)=>{for(var n in t)zt(e,n,{get:t[n],enumerable:!0})},en=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of Ut(t))!Kt.call(e,i)&&i!==n&&zt(e,i,{get:()=>t[i],enumerable:!(r=Vt(t,i))||r.enumerable});return e},V=((e,t,n)=>(n=e==null?{}:Rt(Gt(e)),en(t||!e||!e.__esModule?zt(n,`default`,{value:e,enumerable:!0}):n,e)))(Qt({"../../node_modules/.pnpm/prismjs@1.29.0_patch_hash=vrxx3pzkik6jpmgpayxfjunetu/node_modules/prismjs/prism.js"(e,t){var n=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/\u00a0/g,` `)},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,`__id`,{value:++t}),e.__id},clone:function e(t,n){n||={};var i,a;switch(r.util.type(t)){case`Object`:if(a=r.util.objId(t),n[a])return n[a];for(var o in i={},n[a]=i,t)t.hasOwnProperty(o)&&(i[o]=e(t[o],n));return i;case`Array`:return a=r.util.objId(t),n[a]?n[a]:(i=[],n[a]=i,t.forEach(function(t,r){i[r]=e(t,n)}),i);default:return t}},getLanguage:function(t){for(;t;){var n=e.exec(t.className);if(n)return n[1].toLowerCase();t=t.parentElement}return`none`},setLanguage:function(t,n){t.className=t.className.replace(RegExp(e,`gi`),``),t.classList.add(`language-`+n)},isActive:function(e,t,n){for(var r=`no-`+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var i in t)n[i]=t[i];return n},insertBefore:function(e,t,n,i){i||=r.languages;var a=i[e],o={};for(var s in a)if(a.hasOwnProperty(s)){if(s==t)for(var c in n)n.hasOwnProperty(c)&&(o[c]=n[c]);n.hasOwnProperty(s)||(o[s]=a[s])}var l=i[e];return i[e]=o,r.languages.DFS(r.languages,function(t,n){n===l&&t!=e&&(this[t]=o)}),o},DFS:function e(t,n,i,a){a||={};var o=r.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],i||s);var c=t[s],l=r.util.type(c);l===`Object`&&!a[o(c)]?(a[o(c)]=!0,e(c,n,null,a)):l===`Array`&&!a[o(c)]&&(a[o(c)]=!0,e(c,n,s,a))}}},plugins:{},highlight:function(e,t,n){var a={code:e,grammar:t,language:n};if(r.hooks.run(`before-tokenize`,a),!a.grammar)throw Error(`The language "`+a.language+`" has no grammar.`);return a.tokens=r.tokenize(a.code,a.grammar),r.hooks.run(`after-tokenize`,a),i.stringify(r.util.encode(a.tokens),a.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new s;return c(i,i.head,e),o(e,i,t,i.head,0),u(i)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(!(!n||!n.length))for(var i=0,a;a=n[i++];)a(t)}},Token:i};function i(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}i.stringify=function e(t,n){if(typeof t==`string`)return t;if(Array.isArray(t)){var i=``;return t.forEach(function(t){i+=e(t,n)}),i}var a={type:t.type,content:e(t.content,n),tag:`span`,classes:[`token`,t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),r.hooks.run(`wrap`,a);var s=``;for(var c in a.attributes)s+=` `+c+`="`+(a.attributes[c]||``).replace(/"/g,`&quot;`)+`"`;return`<`+a.tag+` class="`+a.classes.join(` `)+`"`+s+`>`+a.content+`</`+a.tag+`>`};function a(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function o(e,t,n,s,u,d){for(var f in n)if(!(!n.hasOwnProperty(f)||!n[f])){var p=n[f];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==f+`,`+m)return;var h=p[m],g=h.inside,_=!!h.lookbehind,v=!!h.greedy,y=h.alias;if(v&&!h.pattern.global){var b=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,b+`g`)}for(var x=h.pattern||h,S=s.next,C=u;S!==t.tail&&!(d&&C>=d.reach);C+=S.value.length,S=S.next){var w=S.value;if(t.length>e.length)return;if(!(w instanceof i)){var T=1,E;if(v){if(E=a(x,C,e,_),!E||E.index>=e.length)break;var D=E.index,O=E.index+E[0].length,k=C;for(k+=S.value.length;D>=k;)S=S.next,k+=S.value.length;if(k-=S.value.length,C=k,S.value instanceof i)continue;for(var A=S;A!==t.tail&&(k<O||typeof A.value==`string`);A=A.next)T++,k+=A.value.length;T--,w=e.slice(C,k),E.index-=C}else if(E=a(x,0,w,_),!E)continue;var D=E.index,j=E[0],M=w.slice(0,D),N=w.slice(D+j.length),P=C+w.length;d&&P>d.reach&&(d.reach=P);var ee=S.prev;M&&(ee=c(t,ee,M),C+=M.length),l(t,ee,T);var F=new i(f,g?r.tokenize(j,g):j,y,j);if(S=c(t,ee,F),N&&c(t,S,N),T>1){var I={cause:f+`,`+m,reach:P};o(e,t,n,S.prev,C,I),d&&I.reach>d.reach&&(d.reach=I.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function l(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}function u(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}return r}();t.exports=n,n.default=n}})());V.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},V.languages.markup.tag.inside[`attr-value`].inside.entity=V.languages.markup.entity,V.languages.markup.doctype.inside[`internal-subset`].inside=V.languages.markup,V.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.replace(/&amp;/,`&`))}),Object.defineProperty(V.languages.markup.tag,`addInlined`,{value:function(e,t){var n={},n=(n[`language-`+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:V.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i,{"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}}),t=(n[`language-`+t]={pattern:/[\s\S]+/,inside:V.languages[t]},{});t[e]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return e}),`i`),lookbehind:!0,greedy:!0,inside:n},V.languages.insertBefore(`markup`,`cdata`,t)}}),Object.defineProperty(V.languages.markup.tag,`addAttribute`,{value:function(e,t){V.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+e+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,`language-`+t],inside:V.languages[t]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),V.languages.html=V.languages.markup,V.languages.mathml=V.languages.markup,V.languages.svg=V.languages.markup,V.languages.xml=V.languages.extend(`markup`,{}),V.languages.ssml=V.languages.xml,V.languages.atom=V.languages.xml,V.languages.rss=V.languages.xml,function(e){var t={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:`escape`},n=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,r=`(?:[^\\\\-]|`+n.source+`)`,r=RegExp(r+`-`+r),i={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:`variable`};e.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:`operator`},"char-class-punctuation":{pattern:/^\[|\]$/,alias:`punctuation`},range:{pattern:r,inside:{escape:n,"range-punctuation":{pattern:/-/,alias:`operator`}}},"special-escape":t,"char-set":{pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:`class-name`},escape:n}},"special-escape":t,"char-set":{pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:`class-name`},backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:`keyword`},{pattern:/\\k<[^<>']+>/,alias:`keyword`,inside:{"group-name":i}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:`function`},escape:n,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,alias:`punctuation`,inside:{"group-name":i}},{pattern:/\)/,alias:`punctuation`}],quantifier:{pattern:/(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,alias:`number`},alternation:{pattern:/\|/,alias:`keyword`}}}(V),V.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},V.languages.javascript=V.languages.extend(`clike`,{"class-name":[V.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),V.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,V.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:V.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:V.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:V.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:V.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:V.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),V.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:V.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),V.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),V.languages.markup&&(V.languages.markup.tag.addInlined(`script`,`javascript`),V.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),V.languages.js=V.languages.javascript,V.languages.actionscript=V.languages.extend(`javascript`,{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),V.languages.actionscript[`class-name`].alias=`function`,delete V.languages.actionscript.parameter,delete V.languages.actionscript[`literal-property`],V.languages.markup&&V.languages.insertBefore(`actionscript`,`string`,{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:V.languages.markup}}),function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:`variable`};e.languages.coffeescript=e.languages.extend(`javascript`,{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:`variable`}}),e.languages.insertBefore(`coffeescript`,`comment`,{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:`comment`},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:`regex`,inside:{comment:t,interpolation:n}}}),e.languages.insertBefore(`coffeescript`,`string`,{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:`punctuation`},script:{pattern:/[\s\S]+/,alias:`language-javascript`,inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:`string`},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:`string`,inside:{interpolation:n}}]}),e.languages.insertBefore(`coffeescript`,`keyword`,{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript[`template-string`],e.languages.coffee=e.languages.coffeescript}(V),function(e){var t=e.languages.javadoclike={parameter:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/};Object.defineProperty(t,`addSupport`,{value:function(t,n){(t=typeof t==`string`?[t]:t).forEach(function(t){var r=function(e){e.inside||={},e.inside.rest=n},i=`doc-comment`;if(a=e.languages[t]){var a,o=a[i];if((o||=(a=e.languages.insertBefore(t,`comment`,{"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,lookbehind:!0,alias:`comment`}}))[i])instanceof RegExp&&(o=a[i]={pattern:o}),Array.isArray(o))for(var s=0,c=o.length;s<c;s++)o[s]instanceof RegExp&&(o[s]={pattern:o[s]}),r(o[s]);else r(o)}})}}),t.addSupport([`java`,`javascript`,`php`],t)}(V),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,t=(e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:`selector`},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp(`\\burl\\((?:`+t.source+`|(?:[^\\\\\\r\\n()"']|\\\\[\\s\\S])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css,e.languages.markup);t&&(t.tag.addInlined(`style`,`css`),t.tag.addAttribute(`style`,`css`))}(V),function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,t=(e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp(`\\[(?:[^[\\]"']|`+t.source+`)*\\]`),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:`keyword`},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[t,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside[`selector-function-argument`].inside=t,e.languages.insertBefore(`css`,`property`,{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}}),{pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0}),n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore(`css`,`function`,{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:`color`},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,number:n})}(V),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r=`(?:`+n.source+`(?:[ ]+`+t.source+`)?|`+t.source+`(?:[ ]+`+n.source+`)?)`,i=`(?:[^\\s\\x00-\\x08\\x0e-\\x1f!"#%&'*,\\-:>?@[\\]\`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-]<PLAIN>)(?:[ \\t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*`.replace(/<PLAIN>/g,function(){return`[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]`}),a=`"(?:[^"\\\\\\r\\n]|\\\\.)*"|'(?:[^'\\\\\\r\\n]|\\\\.)*'`;function o(e,t){t=(t||``).replace(/m/g,``)+`m`;var n=`([:\\-,[{]\\s*(?:\\s<<prop>>[ \\t]+)?)(?:<<value>>)(?=[ \\t]*(?:$|,|\\]|\\}|(?:[\\r\\n]\\s*)?#))`.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return e});return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(`([\\-:]\\s*(?:\\s<<prop>>[ \\t]+)?[|>])[ \\t]*(?:((?:\\r?\\n|\\r)[ \\t]+)\\S[^\\r\\n]*(?:\\2[^\\r\\n]+)*)`.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:`string`},comment:/#.*/,key:{pattern:RegExp(`((?:^|[:\\-,[{\\r\\n?])[ \\t]*(?:<<prop>>[ \\t]+)?)<<key>>(?=\\s*:\\s)`.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return`(?:`+i+`|`+a+`)`})),lookbehind:!0,greedy:!0,alias:`atrule`},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:`important`},datetime:{pattern:o(`\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \\t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \\t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?`),lookbehind:!0,alias:`number`},boolean:{pattern:o(`false|true`,`i`),lookbehind:!0,alias:`important`},null:{pattern:o(`null|~`,`i`),lookbehind:!0,alias:`important`},string:{pattern:o(a),lookbehind:!0,greedy:!0},number:{pattern:o(`[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)`,`i`),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(V),function(e){var t=`(?:\\\\.|[^\\\\\\n\\r]|(?:\\n|\\r\\n?)(?![\\r\\n]))`;function n(e){return e=e.replace(/<inner>/g,function(){return t}),RegExp(`((?:^|[^\\\\])(?:\\\\{2})*)(?:`+e+`)`)}var r="(?:\\\\.|``(?:[^`\\r\\n]|`(?!`))+``|`[^`\\r\\n]+`|[^\\\\|\\r\\n`])+",i=`\\|?__(?:\\|__)+\\|?(?:(?:\\n|\\r\\n?)|(?![\\s\\S]))`.replace(/__/g,function(){return r}),a=`\\|?[ \\t]*:?-{3,}:?[ \\t]*(?:\\|[ \\t]*:?-{3,}:?[ \\t]*)+\\|?(?:\\n|\\r\\n?)`,o=(e.languages.markdown=e.languages.extend(`markup`,{}),e.languages.insertBefore(`markdown`,`prolog`,{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:[`yaml`,`language-yaml`],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:`punctuation`},table:{pattern:RegExp(`^`+i+a+`(?:`+i+`)*`,`m`),inside:{"table-data-rows":{pattern:RegExp(`^(`+i+a+`)(?:`+i+`)*$`),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp(`^(`+i+`)`+a+`$`),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp(`^`+i+`$`),inside:{"table-header":{pattern:RegExp(r),alias:`important`,inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:`keyword`},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:`important`,inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:`important`,inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:`punctuation`},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:`punctuation`},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:`url`},bold:{pattern:n(`\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(`\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(`(~~?)(?:(?!~)<inner>)+\\2`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:[`code`,`keyword`]},url:{pattern:n(`!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \\t]?\\[(?:(?!\\])<inner>)+\\])`),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),[`url`,`bold`,`italic`,`strike`].forEach(function(t){[`url`,`bold`,`italic`,`strike`,`code-snippet`].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add(`after-tokenize`,function(e){e.language!==`markdown`&&e.language!==`md`||function e(t){if(t&&typeof t!=`string`)for(var n=0,r=t.length;n<r;n++){var i,a=t[n];a.type===`code`?(i=a.content[1],a=a.content[3],i&&a&&i.type===`code-language`&&a.type===`code-block`&&typeof i.content==`string`&&(i=i.content.replace(/\b#/g,`sharp`).replace(/\b\+\+/g,`pp`),i=`language-`+(i=(/[a-z][\w-]*/i.exec(i)||[``])[0].toLowerCase()),a.alias?typeof a.alias==`string`?a.alias=[a.alias,i]:a.alias.push(i):a.alias=[i])):e(a.content)}}(e.tokens)}),e.hooks.add(`wrap`,function(t){if(t.type===`code-block`){for(var n=``,r=0,i=t.classes.length;r<i;r++){var a=t.classes[r],a=/language-(.+)/.exec(a);if(a){n=a[1];break}}var l,u=e.languages[n];u?t.content=e.highlight(function(e){return e=e.replace(o,``),e=e.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(e,t){var n;return(t=t.toLowerCase())[0]===`#`?(n=t[1]===`x`?parseInt(t.slice(2),16):Number(t.slice(1)),c(n)):s[t]||e})}(t.content),u,n):n&&n!==`none`&&e.plugins.autoloader&&(l=`md-`+new Date().valueOf()+`-`+Math.floor(0x2386f26fc10000*Math.random()),t.attributes.id=l,e.plugins.autoloader.loadLanguages(n,function(){var t=document.getElementById(l);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}),RegExp(e.languages.markup.tag.pattern.source,`gi`)),s={amp:`&`,lt:`<`,gt:`>`,quot:`"`},c=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(V),V.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:`string`,inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:V.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:`function`},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:`class-name`},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:`function`},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},V.hooks.add(`after-tokenize`,function(e){if(e.language===`graphql`)for(var t=e.tokens.filter(function(e){return typeof e!=`string`&&e.type!==`comment`&&e.type!==`scalar`}),n=0;n<t.length;){var r=t[n++];if(r.type===`keyword`&&r.content===`mutation`){var i=[];if(d([`definition-mutation`,`punctuation`])&&u(1).content===`(`){n+=2;var a=f(/^\($/,/^\)$/);if(a===-1)continue;for(;n<a;n++){var o=u(0);o.type===`variable`&&(p(o,`variable-input`),i.push(o.content))}n=a+1}if(d([`punctuation`,`property-query`])&&u(0).content===`{`&&(n++,p(u(0),`property-mutation`),0<i.length)){var s=f(/^\{$/,/^\}$/);if(s!==-1)for(var c=n;c<s;c++){var l=t[c];l.type===`variable`&&0<=i.indexOf(l.content)&&p(l,`variable-input`)}}}}function u(e){return t[n+e]}function d(e,t){t||=0;for(var n=0;n<e.length;n++){var r=u(n+t);if(!r||r.type!==e[n])return}return 1}function f(e,r){for(var i=1,a=n;a<t.length;a++){var o=t[a],s=o.content;if(o.type===`punctuation`&&typeof s==`string`){if(e.test(s))i++;else if(r.test(s)&&--i===0)return a}}return-1}function p(e,t){var n=e.alias;n?Array.isArray(n)||(e.alias=n=[n]):e.alias=n=[],n.push(t)}}),V.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript[`template-string`],n=t.pattern.source,r=t.inside.interpolation,i=r.inside[`interpolation-punctuation`],a=r.pattern.source;function o(t,r){if(e.languages[t])return{pattern:RegExp(`((?:`+r+`)\\s*)`+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function s(t,n,r){return t={code:t,grammar:n,language:r},e.hooks.run(`before-tokenize`,t),t.tokens=e.tokenize(t.code,t.grammar),e.hooks.run(`after-tokenize`,t),t.tokens}function c(t,n,o){var c=e.tokenize(t,{interpolation:{pattern:RegExp(a),lookbehind:!0}}),l=0,u={},c=s(c.map(function(e){if(typeof e==`string`)return e;for(var n,r,e=e.content;t.indexOf((r=l++,n=`___`+o.toUpperCase()+`_`+r+`___`))!==-1;);return u[n]=e,n}).join(``),n,o),d=Object.keys(u);return l=0,function t(n){for(var a=0;a<n.length;a++){if(l>=d.length)return;var o,c,f,p,m,h,g,_=n[a];typeof _==`string`||typeof _.content==`string`?(o=d[l],(g=(h=typeof _==`string`?_:_.content).indexOf(o))!==-1&&(++l,c=h.substring(0,g),m=u[o],f=void 0,(p={})[`interpolation-punctuation`]=i,(p=e.tokenize(m,p)).length===3&&((f=[1,1]).push.apply(f,s(p[1],e.languages.javascript,`javascript`)),p.splice.apply(p,f)),f=new e.Token(`interpolation`,p,r.alias,m),p=h.substring(g+o.length),m=[],c&&m.push(c),m.push(f),p&&(t(h=[p]),m.push.apply(m,h)),typeof _==`string`?(n.splice.apply(n,[a,1].concat(m)),a+=m.length-1):_.content=m)):(g=_.content,t(Array.isArray(g)?g:[g]))}}(c),new e.Token(o,c,`language-`+o,t)}e.languages.javascript[`template-string`]=[o(`css`,`\\b(?:styled(?:\\([^)]*\\))?(?:\\s*\\.\\s*\\w+(?:\\([^)]*\\))*)*|css(?:\\s*\\.\\s*(?:global|resolve))?|createGlobalStyle|keyframes)`),o(`html`,`\\bhtml|\\.\\s*(?:inner|outer)HTML\\s*\\+?=`),o(`svg`,`\\bsvg`),o(`markdown`,`\\b(?:markdown|md)`),o(`graphql`,`\\b(?:gql|graphql(?:\\s*\\.\\s*experimental)?)`),o(`sql`,`\\bsql`),t].filter(Boolean);var l={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function u(e){return typeof e==`string`?e:Array.isArray(e)?e.map(u).join(``):u(e.content)}e.hooks.add(`after-tokenize`,function(t){t.language in l&&function t(n){for(var r=0,i=n.length;r<i;r++){var a,o,s,l=n[r];typeof l!=`string`&&(a=l.content,Array.isArray(a)?l.type===`template-string`?(l=a[1],a.length===3&&typeof l!=`string`&&l.type===`embedded-code`&&(o=u(l),l=l.alias,l=Array.isArray(l)?l[0]:l,s=e.languages[l])&&(a[1]=c(o,s,l))):t(a):typeof a!=`string`&&t([a]))}}(t.tokens)})}(V),function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript}(V),function(e){var t=e.languages.javascript,n=`\\{(?:[^{}]|\\{(?:[^{}]|\\{[^{}]*\\})*\\})+\\}`,r=`(@(?:arg|argument|param|property)\\s+(?:`+n+`\\s+)?)`;e.languages.jsdoc=e.languages.extend(`javadoclike`,{parameter:{pattern:RegExp(r+`(?:(?!\\s)[$\\w\\xA0-\\uFFFF.])+(?=\\s|$)`),lookbehind:!0,inside:{punctuation:/\./}}}),e.languages.insertBefore(`jsdoc`,`keyword`,{"optional-parameter":{pattern:RegExp(r+`\\[(?:(?!\\s)[$\\w\\xA0-\\uFFFF.])+(?:=[^[\\]]+)?\\](?=\\s|$)`),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:t,alias:`language-javascript`},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp(`(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\\s+(?:<TYPE>\\s+)?)[A-Z]\\w*(?:\\.[A-Z]\\w*)*`.replace(/<TYPE>/g,function(){return n})),lookbehind:!0,inside:{punctuation:/\./}},{pattern:RegExp(`(@[a-z]+\\s+)`+n),lookbehind:!0,inside:{string:t.string,number:t.number,boolean:t.boolean,keyword:e.languages.typescript.keyword,operator:/=>|\.\.\.|[&|?:*]/,punctuation:/[.,;=<>{}()[\]]/}}],example:{pattern:/(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^([\t ]*(?:\*\s*)?)\S.*$/m,lookbehind:!0,inside:t,alias:`language-javascript`}}}}),e.languages.javadoclike.addSupport(`javascript`,e.languages.jsdoc)}(V),function(e){e.languages.flow=e.languages.extend(`javascript`,{}),e.languages.insertBefore(`flow`,`keyword`,{type:[{pattern:/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,alias:`class-name`}]}),e.languages.flow[`function-variable`].pattern=/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,delete e.languages.flow.parameter,e.languages.insertBefore(`flow`,`operator`,{"flow-punctuation":{pattern:/\{\||\|\}/,alias:`punctuation`}}),Array.isArray(e.languages.flow.keyword)||(e.languages.flow.keyword=[e.languages.flow.keyword]),e.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,lookbehind:!0})}(V),V.languages.n4js=V.languages.extend(`javascript`,{keyword:/\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),V.languages.insertBefore(`n4js`,`constant`,{annotation:{pattern:/@+\w+/,alias:`operator`}}),V.languages.n4jsd=V.languages.n4js,function(e){function t(e,t){return RegExp(e.replace(/<ID>/g,function(){return`(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*`}),t)}e.languages.insertBefore(`javascript`,`function-variable`,{"method-variable":{pattern:RegExp(`(\\.\\s*)`+e.languages.javascript[`function-variable`].pattern.source),lookbehind:!0,alias:[`function-variable`,`method`,`function`,`property-access`]}}),e.languages.insertBefore(`javascript`,`function`,{method:{pattern:RegExp(`(\\.\\s*)`+e.languages.javascript.function.source),lookbehind:!0,alias:[`function`,`property-access`]}}),e.languages.insertBefore(`javascript`,`constant`,{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:`class-name`},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:`class-name`}]}),e.languages.insertBefore(`javascript`,`keyword`,{imports:{pattern:t(`(\\bimport\\b\\s*)(?:<ID>(?:\\s*,\\s*(?:\\*\\s*as\\s+<ID>|\\{[^{}]*\\}))?|\\*\\s*as\\s+<ID>|\\{[^{}]*\\})(?=\\s*\\bfrom\\b)`),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(`(\\bexport\\b\\s*)(?:\\*(?:\\s*as\\s+<ID>)?(?=\\s*\\bfrom\\b)|\\{[^{}]*\\})`),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:`module`},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:`control-flow`},{pattern:/\bnull\b/,alias:[`null`,`nil`]},{pattern:/\bundefined\b/,alias:`nil`}),e.languages.insertBefore(`javascript`,`operator`,{spread:{pattern:/\.{3}/,alias:`operator`},arrow:{pattern:/=>/,alias:`operator`}}),e.languages.insertBefore(`javascript`,`punctuation`,{"property-access":{pattern:t(`(\\.\\s*)#?<ID>`),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:`variable`},console:{pattern:/\bconsole(?=\s*\.)/,alias:`class-name`}});for(var n=[`function`,`function-variable`,`method`,`method-variable`,`property-access`],r=0;r<n.length;r++){var i=n[r],a=e.languages.javascript[i],i=(a=e.util.type(a)===`RegExp`?e.languages.javascript[i]={pattern:a}:a).inside||{};(a.inside=i)[`maybe-class-name`]=/^[A-Z][\s\S]*/}}(V),function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);function o(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?0<n.length&&n[n.length-1].tagName===s(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content!==`/>`&&n.push({tagName:s(i.content[0].content[1]),openedBraces:0}):0<n.length&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:0<n.length&&0<n[n.length-1].openedBraces&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&0<n.length&&n[n.length-1].openedBraces===0&&(a=s(i),r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(a+=s(t[r+1]),t.splice(r+1,1)),0<r&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(a=s(t[r-1])+a,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,a,null,a)),i.content&&typeof i.content!=`string`&&o(i.content)}}var s=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(s).join(``):``};e.hooks.add(`after-tokenize`,function(e){e.language!==`jsx`&&e.language!==`tsx`||o(e.tokens)})}(V),function(e){var t=e.util.clone(e.languages.typescript),t=(e.languages.tsx=e.languages.extend(`jsx`,t),delete e.languages.tsx.parameter,delete e.languages.tsx[`literal-property`],e.languages.tsx.tag);t.pattern=RegExp(`(^|[^\\w$]|(?=<\\/))(?:`+t.pattern.source+`)`,t.pattern.flags),t.lookbehind=!0}(V),V.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(`(^|[^"#])(?:"(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^(])|[^\\\\\\r\\n"])*"|"""(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|[^(])|[^\\\\"]|"(?!""))*""")(?!["#])`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:`punctuation`},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(`(^|[^"#])(#+)(?:"(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^#])|[^\\\\\\r\\n])*?"|"""(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|[^#])|[^\\\\])*?""")\\2`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:`punctuation`},string:/[\s\S]+/}}],directive:{pattern:RegExp(`#(?:(?:elseif|if)\\b(?:[ ]*(?:![ \\t]*)?(?:\\b\\w+\\b(?:[ \\t]*\\((?:[^()]|\\([^()]*\\))*\\))?|\\((?:[^()]|\\([^()]*\\))*\\))(?:[ \\t]*(?:&&|\\|\\|))?)+|(?:else|endif)\\b)`),alias:`property`,inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:`constant`},"other-directive":{pattern:/#\w+\b/,alias:`property`},attribute:{pattern:/@\w+/,alias:`atrule`},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:`function`},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:`important`},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:`constant`},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:`keyword`},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},V.languages.swift[`string-literal`].forEach(function(e){e.inside.interpolation.inside=V.languages.swift}),function(e){e.languages.kotlin=e.languages.extend(`clike`,{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin[`class-name`];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:`punctuation`},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore(`kotlin`,`string`,{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:`multiline`,inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:`singleline`,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore(`kotlin`,`keyword`,{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:`builtin`}}),e.languages.insertBefore(`kotlin`,`function`,{label:{pattern:/\b\w+@|@\w+\b/,alias:`symbol`}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin}(V),V.languages.c=V.languages.extend(`clike`,{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),V.languages.insertBefore(`c`,`string`,{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),V.languages.insertBefore(`c`,`string`,{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:`property`,inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},V.languages.c.string],char:V.languages.c.char,comment:V.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:`function`}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:`keyword`},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:V.languages.c}}}}),V.languages.insertBefore(`c`,`function`,{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete V.languages.c.boolean,V.languages.objectivec=V.languages.extend(`c`,{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete V.languages.objectivec[`class-name`],V.languages.objc=V.languages.objectivec,V.languages.reason=V.languages.extend(`clike`,{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),V.languages.insertBefore(`reason`,`class-name`,{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:`symbol`}}),delete V.languages.reason.function,function(e){for(var t=`\\/\\*(?:[^*/]|\\*(?!\\/)|\\/(?!\\*)|<self>)*\\*\\/`,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return`[^\\s\\S]`}),e.languages.rust={comment:[{pattern:RegExp(`(^|[^\\\\])`+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:`attr-name`,inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:`punctuation`},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:`symbol`},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:`punctuation`},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:`function`},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:`class-name`},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:`namespace`},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:`namespace`,inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:`property`},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust[`closure-params`].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(V),V.languages.go=V.languages.extend(`clike`,{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),V.languages.insertBefore(`go`,`string`,{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete V.languages.go[`class-name`],function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=`\\b(?!<keyword>)\\w+(?:\\s*\\.\\s*\\w+)*\\b`.replace(/<keyword>/g,function(){return t.source});e.languages.cpp=e.languages.extend(`c`,{"class-name":[{pattern:RegExp(`(\\b(?:class|concept|enum|struct|typename)\\s+)(?!<keyword>)\\w+`.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore(`cpp`,`string`,{module:{pattern:RegExp(`(\\b(?:import|module)\\s+)(?:"(?:\\\\(?:\\r\\n|[\\s\\S])|[^"\\\\\\r\\n])*"|<[^<>\\r\\n]*>|`+`<mod-name>(?:\\s*:\\s*<mod-name>)?|:\\s*<mod-name>`.replace(/<mod-name>/g,function(){return n})+`)`),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:`string`,greedy:!0}}),e.languages.insertBefore(`cpp`,`keyword`,{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:e.languages.cpp}}}}),e.languages.insertBefore(`cpp`,`operator`,{"double-colon":{pattern:/::/,alias:`punctuation`}}),e.languages.insertBefore(`cpp`,`class-name`,{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend(`cpp`,{})}}),e.languages.insertBefore(`inside`,`double-colon`,{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp[`base-clause`])}(V),V.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:`punctuation`},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:`string`},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:[`annotation`,`punctuation`],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},V.languages.python[`string-interpolation`].inside.interpolation.inside.rest=V.languages.python,V.languages.py=V.languages.python,V.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},V.languages.webmanifest=V.languages.json;var tn={};$t(tn,{dracula:()=>nn,duotoneDark:()=>rn,duotoneLight:()=>an,github:()=>on,gruvboxMaterialDark:()=>Sn,gruvboxMaterialLight:()=>Cn,jettwaveDark:()=>vn,jettwaveLight:()=>yn,nightOwl:()=>sn,nightOwlLight:()=>cn,oceanicNext:()=>un,okaidia:()=>dn,oneDark:()=>bn,oneLight:()=>xn,palenight:()=>fn,shadesOfPurple:()=>pn,synthwave84:()=>mn,ultramin:()=>hn,vsDark:()=>gn,vsLight:()=>_n});var nn={plain:{color:`#F8F8F2`,backgroundColor:`#282A36`},styles:[{types:[`prolog`,`constant`,`builtin`],style:{color:`rgb(189, 147, 249)`}},{types:[`inserted`,`function`],style:{color:`rgb(80, 250, 123)`}},{types:[`deleted`],style:{color:`rgb(255, 85, 85)`}},{types:[`changed`],style:{color:`rgb(255, 184, 108)`}},{types:[`punctuation`,`symbol`],style:{color:`rgb(248, 248, 242)`}},{types:[`string`,`char`,`tag`,`selector`],style:{color:`rgb(255, 121, 198)`}},{types:[`keyword`,`variable`],style:{color:`rgb(189, 147, 249)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(98, 114, 164)`}},{types:[`attr-name`],style:{color:`rgb(241, 250, 140)`}}]},rn={plain:{backgroundColor:`#2a2734`,color:`#9a86fd`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`,`punctuation`],style:{color:`#6c6783`}},{types:[`namespace`],style:{opacity:.7}},{types:[`tag`,`operator`,`number`],style:{color:`#e09142`}},{types:[`property`,`function`],style:{color:`#9a86fd`}},{types:[`tag-id`,`selector`,`atrule-id`],style:{color:`#eeebff`}},{types:[`attr-name`],style:{color:`#c4b9fe`}},{types:[`boolean`,`string`,`entity`,`url`,`attr-value`,`keyword`,`control`,`directive`,`unit`,`statement`,`regex`,`atrule`,`placeholder`,`variable`],style:{color:`#ffcc99`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`#c4b9fe`}}]},an={plain:{backgroundColor:`#faf8f5`,color:`#728fcb`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`,`punctuation`],style:{color:`#b6ad9a`}},{types:[`namespace`],style:{opacity:.7}},{types:[`tag`,`operator`,`number`],style:{color:`#063289`}},{types:[`property`,`function`],style:{color:`#b29762`}},{types:[`tag-id`,`selector`,`atrule-id`],style:{color:`#2d2006`}},{types:[`attr-name`],style:{color:`#896724`}},{types:[`boolean`,`string`,`entity`,`url`,`attr-value`,`keyword`,`control`,`directive`,`unit`,`statement`,`regex`,`atrule`],style:{color:`#728fcb`}},{types:[`placeholder`,`variable`],style:{color:`#93abdc`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`#896724`}}]},on={plain:{color:`#393A34`,backgroundColor:`#f6f8fa`},styles:[{types:[`comment`,`prolog`,`doctype`,`cdata`],style:{color:`#999988`,fontStyle:`italic`}},{types:[`namespace`],style:{opacity:.7}},{types:[`string`,`attr-value`],style:{color:`#e3116c`}},{types:[`punctuation`,`operator`],style:{color:`#393A34`}},{types:[`entity`,`url`,`symbol`,`number`,`boolean`,`variable`,`constant`,`property`,`regex`,`inserted`],style:{color:`#36acaa`}},{types:[`atrule`,`keyword`,`attr-name`,`selector`],style:{color:`#00a4db`}},{types:[`function`,`deleted`,`tag`],style:{color:`#d73a49`}},{types:[`function-variable`],style:{color:`#6f42c1`}},{types:[`tag`,`selector`,`keyword`],style:{color:`#00009f`}}]},sn={plain:{color:`#d6deeb`,backgroundColor:`#011627`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`,fontStyle:`italic`}},{types:[`inserted`,`attr-name`],style:{color:`rgb(173, 219, 103)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(99, 119, 119)`,fontStyle:`italic`}},{types:[`string`,`url`],style:{color:`rgb(173, 219, 103)`}},{types:[`variable`],style:{color:`rgb(214, 222, 235)`}},{types:[`number`],style:{color:`rgb(247, 140, 108)`}},{types:[`builtin`,`char`,`constant`,`function`],style:{color:`rgb(130, 170, 255)`}},{types:[`punctuation`],style:{color:`rgb(199, 146, 234)`}},{types:[`selector`,`doctype`],style:{color:`rgb(199, 146, 234)`,fontStyle:`italic`}},{types:[`class-name`],style:{color:`rgb(255, 203, 139)`}},{types:[`tag`,`operator`,`keyword`],style:{color:`rgb(127, 219, 202)`}},{types:[`boolean`],style:{color:`rgb(255, 88, 116)`}},{types:[`property`],style:{color:`rgb(128, 203, 196)`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`}}]},cn={plain:{color:`#403f53`,backgroundColor:`#FBFBFB`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`,fontStyle:`italic`}},{types:[`inserted`,`attr-name`],style:{color:`rgb(72, 118, 214)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`rgb(152, 159, 177)`,fontStyle:`italic`}},{types:[`string`,`builtin`,`char`,`constant`,`url`],style:{color:`rgb(72, 118, 214)`}},{types:[`variable`],style:{color:`rgb(201, 103, 101)`}},{types:[`number`],style:{color:`rgb(170, 9, 130)`}},{types:[`punctuation`],style:{color:`rgb(153, 76, 195)`}},{types:[`function`,`selector`,`doctype`],style:{color:`rgb(153, 76, 195)`,fontStyle:`italic`}},{types:[`class-name`],style:{color:`rgb(17, 17, 17)`}},{types:[`tag`],style:{color:`rgb(153, 76, 195)`}},{types:[`operator`,`property`,`keyword`,`namespace`],style:{color:`rgb(12, 150, 155)`}},{types:[`boolean`],style:{color:`rgb(188, 84, 84)`}}]},ln={char:`#D8DEE9`,comment:`#999999`,keyword:`#c5a5c5`,primitive:`#5a9bcf`,string:`#8dc891`,variable:`#d7deea`,boolean:`#ff8b50`,punctuation:`#5FB3B3`,tag:`#fc929e`,function:`#79b6f2`,className:`#FAC863`,method:`#6699CC`,operator:`#fc929e`},un={plain:{backgroundColor:`#282c34`,color:`#ffffff`},styles:[{types:[`attr-name`],style:{color:ln.keyword}},{types:[`attr-value`],style:{color:ln.string}},{types:[`comment`,`block-comment`,`prolog`,`doctype`,`cdata`,`shebang`],style:{color:ln.comment}},{types:[`property`,`number`,`function-name`,`constant`,`symbol`,`deleted`],style:{color:ln.primitive}},{types:[`boolean`],style:{color:ln.boolean}},{types:[`tag`],style:{color:ln.tag}},{types:[`string`],style:{color:ln.string}},{types:[`punctuation`],style:{color:ln.string}},{types:[`selector`,`char`,`builtin`,`inserted`],style:{color:ln.char}},{types:[`function`],style:{color:ln.function}},{types:[`operator`,`entity`,`url`,`variable`],style:{color:ln.variable}},{types:[`keyword`],style:{color:ln.keyword}},{types:[`atrule`,`class-name`],style:{color:ln.className}},{types:[`important`],style:{fontWeight:`400`}},{types:[`bold`],style:{fontWeight:`bold`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`namespace`],style:{opacity:.7}}]},dn={plain:{color:`#f8f8f2`,backgroundColor:`#272822`},styles:[{types:[`changed`],style:{color:`rgb(162, 191, 252)`,fontStyle:`italic`}},{types:[`deleted`],style:{color:`#f92672`,fontStyle:`italic`}},{types:[`inserted`],style:{color:`rgb(173, 219, 103)`,fontStyle:`italic`}},{types:[`comment`],style:{color:`#8292a2`,fontStyle:`italic`}},{types:[`string`,`url`],style:{color:`#a6e22e`}},{types:[`variable`],style:{color:`#f8f8f2`}},{types:[`number`],style:{color:`#ae81ff`}},{types:[`builtin`,`char`,`constant`,`function`,`class-name`],style:{color:`#e6db74`}},{types:[`punctuation`],style:{color:`#f8f8f2`}},{types:[`selector`,`doctype`],style:{color:`#a6e22e`,fontStyle:`italic`}},{types:[`tag`,`operator`,`keyword`],style:{color:`#66d9ef`}},{types:[`boolean`],style:{color:`#ae81ff`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`,opacity:.7}},{types:[`tag`,`property`],style:{color:`#f92672`}},{types:[`attr-name`],style:{color:`#a6e22e !important`}},{types:[`doctype`],style:{color:`#8292a2`}},{types:[`rule`],style:{color:`#e6db74`}}]},fn={plain:{color:`#bfc7d5`,backgroundColor:`#292d3e`},styles:[{types:[`comment`],style:{color:`rgb(105, 112, 152)`,fontStyle:`italic`}},{types:[`string`,`inserted`],style:{color:`rgb(195, 232, 141)`}},{types:[`number`],style:{color:`rgb(247, 140, 108)`}},{types:[`builtin`,`char`,`constant`,`function`],style:{color:`rgb(130, 170, 255)`}},{types:[`punctuation`,`selector`],style:{color:`rgb(199, 146, 234)`}},{types:[`variable`],style:{color:`rgb(191, 199, 213)`}},{types:[`class-name`,`attr-name`],style:{color:`rgb(255, 203, 107)`}},{types:[`tag`,`deleted`],style:{color:`rgb(255, 85, 114)`}},{types:[`operator`],style:{color:`rgb(137, 221, 255)`}},{types:[`boolean`],style:{color:`rgb(255, 88, 116)`}},{types:[`keyword`],style:{fontStyle:`italic`}},{types:[`doctype`],style:{color:`rgb(199, 146, 234)`,fontStyle:`italic`}},{types:[`namespace`],style:{color:`rgb(178, 204, 214)`}},{types:[`url`],style:{color:`rgb(221, 221, 221)`}}]},pn={plain:{color:`#9EFEFF`,backgroundColor:`#2D2A55`},styles:[{types:[`changed`],style:{color:`rgb(255, 238, 128)`}},{types:[`deleted`],style:{color:`rgba(239, 83, 80, 0.56)`}},{types:[`inserted`],style:{color:`rgb(173, 219, 103)`}},{types:[`comment`],style:{color:`rgb(179, 98, 255)`,fontStyle:`italic`}},{types:[`punctuation`],style:{color:`rgb(255, 255, 255)`}},{types:[`constant`],style:{color:`rgb(255, 98, 140)`}},{types:[`string`,`url`],style:{color:`rgb(165, 255, 144)`}},{types:[`variable`],style:{color:`rgb(255, 238, 128)`}},{types:[`number`,`boolean`],style:{color:`rgb(255, 98, 140)`}},{types:[`attr-name`],style:{color:`rgb(255, 180, 84)`}},{types:[`keyword`,`operator`,`property`,`namespace`,`tag`,`selector`,`doctype`],style:{color:`rgb(255, 157, 0)`}},{types:[`builtin`,`char`,`constant`,`function`,`class-name`],style:{color:`rgb(250, 208, 0)`}}]},mn={plain:{backgroundColor:`linear-gradient(to bottom, #2a2139 75%, #34294f)`,backgroundImage:`#34294f`,color:`#f92aad`,textShadow:`0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3`},styles:[{types:[`comment`,`block-comment`,`prolog`,`doctype`,`cdata`],style:{color:`#495495`,fontStyle:`italic`}},{types:[`punctuation`],style:{color:`#ccc`}},{types:[`tag`,`attr-name`,`namespace`,`number`,`unit`,`hexcode`,`deleted`],style:{color:`#e2777a`}},{types:[`property`,`selector`],style:{color:`#72f1b8`,textShadow:`0 0 2px #100c0f, 0 0 10px #257c5575, 0 0 35px #21272475`}},{types:[`function-name`],style:{color:`#6196cc`}},{types:[`boolean`,`selector-id`,`function`],style:{color:`#fdfdfd`,textShadow:`0 0 2px #001716, 0 0 3px #03edf975, 0 0 5px #03edf975, 0 0 8px #03edf975`}},{types:[`class-name`,`maybe-class-name`,`builtin`],style:{color:`#fff5f6`,textShadow:`0 0 2px #000, 0 0 10px #fc1f2c75, 0 0 5px #fc1f2c75, 0 0 25px #fc1f2c75`}},{types:[`constant`,`symbol`],style:{color:`#f92aad`,textShadow:`0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3`}},{types:[`important`,`atrule`,`keyword`,`selector-class`],style:{color:`#f4eee4`,textShadow:`0 0 2px #393a33, 0 0 8px #f39f0575, 0 0 2px #f39f0575`}},{types:[`string`,`char`,`attr-value`,`regex`,`variable`],style:{color:`#f87c32`}},{types:[`parameter`],style:{fontStyle:`italic`}},{types:[`entity`,`url`],style:{color:`#67cdcc`}},{types:[`operator`],style:{color:`ffffffee`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`entity`],style:{cursor:`help`}},{types:[`inserted`],style:{color:`green`}}]},hn={plain:{color:`#282a2e`,backgroundColor:`#ffffff`},styles:[{types:[`comment`],style:{color:`rgb(197, 200, 198)`}},{types:[`string`,`number`,`builtin`,`variable`],style:{color:`rgb(150, 152, 150)`}},{types:[`class-name`,`function`,`tag`,`attr-name`],style:{color:`rgb(40, 42, 46)`}}]},gn={plain:{color:`#9CDCFE`,backgroundColor:`#1E1E1E`},styles:[{types:[`prolog`],style:{color:`rgb(0, 0, 128)`}},{types:[`comment`],style:{color:`rgb(106, 153, 85)`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`rgb(86, 156, 214)`}},{types:[`number`,`inserted`],style:{color:`rgb(181, 206, 168)`}},{types:[`constant`],style:{color:`rgb(100, 102, 149)`}},{types:[`attr-name`,`variable`],style:{color:`rgb(156, 220, 254)`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`rgb(206, 145, 120)`}},{types:[`selector`],style:{color:`rgb(215, 186, 125)`}},{types:[`tag`],style:{color:`rgb(78, 201, 176)`}},{types:[`tag`],languages:[`markup`],style:{color:`rgb(86, 156, 214)`}},{types:[`punctuation`,`operator`],style:{color:`rgb(212, 212, 212)`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`rgb(220, 220, 170)`}},{types:[`class-name`],style:{color:`rgb(78, 201, 176)`}},{types:[`char`],style:{color:`rgb(209, 105, 105)`}}]},_n={plain:{color:`#000000`,backgroundColor:`#ffffff`},styles:[{types:[`comment`],style:{color:`rgb(0, 128, 0)`}},{types:[`builtin`],style:{color:`rgb(0, 112, 193)`}},{types:[`number`,`variable`,`inserted`],style:{color:`rgb(9, 134, 88)`}},{types:[`operator`],style:{color:`rgb(0, 0, 0)`}},{types:[`constant`,`char`],style:{color:`rgb(129, 31, 63)`}},{types:[`tag`],style:{color:`rgb(128, 0, 0)`}},{types:[`attr-name`],style:{color:`rgb(255, 0, 0)`}},{types:[`deleted`,`string`],style:{color:`rgb(163, 21, 21)`}},{types:[`changed`,`punctuation`],style:{color:`rgb(4, 81, 165)`}},{types:[`function`,`keyword`],style:{color:`rgb(0, 0, 255)`}},{types:[`class-name`],style:{color:`rgb(38, 127, 153)`}}]},vn={plain:{color:`#f8fafc`,backgroundColor:`#011627`},styles:[{types:[`prolog`],style:{color:`#000080`}},{types:[`comment`],style:{color:`#6A9955`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`#569CD6`}},{types:[`number`,`inserted`],style:{color:`#B5CEA8`}},{types:[`constant`],style:{color:`#f8fafc`}},{types:[`attr-name`,`variable`],style:{color:`#9CDCFE`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`#cbd5e1`}},{types:[`selector`],style:{color:`#D7BA7D`}},{types:[`tag`],style:{color:`#0ea5e9`}},{types:[`tag`],languages:[`markup`],style:{color:`#0ea5e9`}},{types:[`punctuation`,`operator`],style:{color:`#D4D4D4`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`#7dd3fc`}},{types:[`class-name`],style:{color:`#0ea5e9`}},{types:[`char`],style:{color:`#D16969`}}]},yn={plain:{color:`#0f172a`,backgroundColor:`#f1f5f9`},styles:[{types:[`prolog`],style:{color:`#000080`}},{types:[`comment`],style:{color:`#6A9955`}},{types:[`builtin`,`changed`,`keyword`,`interpolation-punctuation`],style:{color:`#0c4a6e`}},{types:[`number`,`inserted`],style:{color:`#B5CEA8`}},{types:[`constant`],style:{color:`#0f172a`}},{types:[`attr-name`,`variable`],style:{color:`#0c4a6e`}},{types:[`deleted`,`string`,`attr-value`,`template-punctuation`],style:{color:`#64748b`}},{types:[`selector`],style:{color:`#D7BA7D`}},{types:[`tag`],style:{color:`#0ea5e9`}},{types:[`tag`],languages:[`markup`],style:{color:`#0ea5e9`}},{types:[`punctuation`,`operator`],style:{color:`#475569`}},{types:[`punctuation`],languages:[`markup`],style:{color:`#808080`}},{types:[`function`],style:{color:`#0e7490`}},{types:[`class-name`],style:{color:`#0ea5e9`}},{types:[`char`],style:{color:`#D16969`}}]},bn={plain:{backgroundColor:`hsl(220, 13%, 18%)`,color:`hsl(220, 14%, 71%)`,textShadow:`0 1px rgba(0, 0, 0, 0.3)`},styles:[{types:[`comment`,`prolog`,`cdata`],style:{color:`hsl(220, 10%, 40%)`}},{types:[`doctype`,`punctuation`,`entity`],style:{color:`hsl(220, 14%, 71%)`}},{types:[`attr-name`,`class-name`,`maybe-class-name`,`boolean`,`constant`,`number`,`atrule`],style:{color:`hsl(29, 54%, 61%)`}},{types:[`keyword`],style:{color:`hsl(286, 60%, 67%)`}},{types:[`property`,`tag`,`symbol`,`deleted`,`important`],style:{color:`hsl(355, 65%, 65%)`}},{types:[`selector`,`string`,`char`,`builtin`,`inserted`,`regex`,`attr-value`],style:{color:`hsl(95, 38%, 62%)`}},{types:[`variable`,`operator`,`function`],style:{color:`hsl(207, 82%, 66%)`}},{types:[`url`],style:{color:`hsl(187, 47%, 55%)`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`hsl(220, 14%, 71%)`}}]},xn={plain:{backgroundColor:`hsl(230, 1%, 98%)`,color:`hsl(230, 8%, 24%)`},styles:[{types:[`comment`,`prolog`,`cdata`],style:{color:`hsl(230, 4%, 64%)`}},{types:[`doctype`,`punctuation`,`entity`],style:{color:`hsl(230, 8%, 24%)`}},{types:[`attr-name`,`class-name`,`boolean`,`constant`,`number`,`atrule`],style:{color:`hsl(35, 99%, 36%)`}},{types:[`keyword`],style:{color:`hsl(301, 63%, 40%)`}},{types:[`property`,`tag`,`symbol`,`deleted`,`important`],style:{color:`hsl(5, 74%, 59%)`}},{types:[`selector`,`string`,`char`,`builtin`,`inserted`,`regex`,`attr-value`,`punctuation`],style:{color:`hsl(119, 34%, 47%)`}},{types:[`variable`,`operator`,`function`],style:{color:`hsl(221, 87%, 60%)`}},{types:[`url`],style:{color:`hsl(198, 99%, 37%)`}},{types:[`deleted`],style:{textDecorationLine:`line-through`}},{types:[`inserted`],style:{textDecorationLine:`underline`}},{types:[`italic`],style:{fontStyle:`italic`}},{types:[`important`,`bold`],style:{fontWeight:`bold`}},{types:[`important`],style:{color:`hsl(230, 8%, 24%)`}}]},Sn={plain:{color:`#ebdbb2`,backgroundColor:`#292828`},styles:[{types:[`imports`,`class-name`,`maybe-class-name`,`constant`,`doctype`,`builtin`,`function`],style:{color:`#d8a657`}},{types:[`property-access`],style:{color:`#7daea3`}},{types:[`tag`],style:{color:`#e78a4e`}},{types:[`attr-name`,`char`,`url`,`regex`],style:{color:`#a9b665`}},{types:[`attr-value`,`string`],style:{color:`#89b482`}},{types:[`comment`,`prolog`,`cdata`,`operator`,`inserted`],style:{color:`#a89984`}},{types:[`delimiter`,`boolean`,`keyword`,`selector`,`important`,`atrule`,`property`,`variable`,`deleted`],style:{color:`#ea6962`}},{types:[`entity`,`number`,`symbol`],style:{color:`#d3869b`}}]},Cn={plain:{color:`#654735`,backgroundColor:`#f9f5d7`},styles:[{types:[`delimiter`,`boolean`,`keyword`,`selector`,`important`,`atrule`,`property`,`variable`,`deleted`],style:{color:`#af2528`}},{types:[`imports`,`class-name`,`maybe-class-name`,`constant`,`doctype`,`builtin`],style:{color:`#b4730e`}},{types:[`string`,`attr-value`],style:{color:`#477a5b`}},{types:[`property-access`],style:{color:`#266b79`}},{types:[`function`,`attr-name`,`char`,`url`],style:{color:`#72761e`}},{types:[`tag`],style:{color:`#b94c07`}},{types:[`comment`,`prolog`,`cdata`,`operator`,`inserted`],style:{color:`#a89984`}},{types:[`entity`,`number`,`symbol`],style:{color:`#924f79`}}]},wn=e=>(0,A.useCallback)(t=>{var n=t,{className:r,style:i,line:a}=n;let o=Xt(Yt({},Zt(n,[`className`,`style`,`line`])),{className:Lt(`token-line`,r)});return typeof e==`object`&&`plain`in e&&(o.style=e.plain),typeof i==`object`&&(o.style=Yt(Yt({},o.style||{}),i)),o},[e]),Tn=e=>{let t=(0,A.useCallback)(({types:t,empty:n})=>{if(e!=null)return t.length===1&&t[0]===`plain`?n==null?void 0:{display:`inline-block`}:t.length===1&&n!=null?e[t[0]]:Object.assign(n==null?{}:{display:`inline-block`},...t.map(t=>e[t]))},[e]);return(0,A.useCallback)(e=>{var n=e,{token:r,className:i,style:a}=n;let o=Xt(Yt({},Zt(n,[`token`,`className`,`style`])),{className:Lt(`token`,...r.types,i),children:r.content,style:t(r)});return a!=null&&(o.style=Yt(Yt({},o.style||{}),a)),o},[t])},En=/\r\n|\r|\n/,Dn=e=>{e.length===0?e.push({types:[`plain`],content:`
13
13
  `,empty:!0}):e.length===1&&e[0].content===``&&(e[0].content=`
14
- `,e[0].empty=!0)},On=(e,t)=>{let n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},kn=e=>{let t=[[]],n=[e],r=[0],i=[e.length],a=0,o=0,s=[],c=[s];for(;o>-1;){for(;(a=r[o]++)<i[o];){let e,l=t[o],u=n[o][a];if(typeof u==`string`?(l=o>0?l:[`plain`],e=u):(l=On(l,u.type),u.alias&&(l=On(l,u.alias)),e=u.content),typeof e!=`string`){o++,t.push(l),n.push(e),r.push(0),i.push(e.length);continue}let d=e.split(En),f=d.length;s.push({types:l,content:d[0]});for(let e=1;e<f;e++)Dn(s),c.push(s=[]),s.push({types:l,content:d[e]})}o--,t.pop(),n.pop(),r.pop(),i.pop()}return Dn(s),c},An=({prism:e,code:t,grammar:n,language:r})=>(0,A.useMemo)(()=>{if(n==null)return kn([t]);let i={code:t,grammar:n,language:r,tokens:[]};return e.hooks.run(`before-tokenize`,i),i.tokens=e.tokenize(t,n),e.hooks.run(`after-tokenize`,i),kn(i.tokens)},[t,n,r,e]),jn=(e,t)=>{let{plain:n}=e,r=e.styles.reduce((e,n)=>{let{languages:r,style:i}=n;return r&&!r.includes(t)||n.types.forEach(t=>{e[t]=Yt(Yt({},e[t]),i)}),e},{});return r.root=n,r.plain=Xt(Yt({},n),{backgroundColor:void 0}),r},Mn=({children:e,language:t,code:n,theme:r,prism:i})=>{let a=t.toLowerCase(),o=jn(r,a),s=wn(o),c=Tn(o),l=i.languages[a];return e({tokens:An({prism:i,language:a,code:n,grammar:l}),className:`prism-code language-${a}`,style:o==null?{}:o.root,getLineProps:s,getTokenProps:c})},Nn=e=>(0,A.createElement)(Mn,Xt(Yt({},e),{prism:e.prism||V,theme:e.theme||gn,code:e.code,language:e.language})),Pn={};function Fn(e){if(!Pn[e]){let t={bash:()=>r(()=>import(`./prism-bash-iQBez6et.js`),[]),sh:()=>r(()=>import(`./prism-bash-iQBez6et.js`),[]),shell:()=>r(()=>import(`./prism-bash-iQBez6et.js`),[]),php:async()=>(await r(()=>import(`./prism-markup-templating-BFXREXfb.js`),[]),r(()=>import(`./prism-php-DjIafOi_.js`),[])),sql:()=>r(()=>import(`./prism-sql-CKkohPI_.js`),[]),ruby:()=>r(()=>import(`./prism-ruby-CZ-lrXfL.js`),[]),java:()=>r(()=>import(`./prism-java-scuShSv5.js`),[]),scala:async()=>(await Fn(`java`),r(()=>import(`./prism-scala-DgnxHuDn.js`),[])),solidity:()=>r(()=>import(`./prism-solidity-5fSUcW9Y.js`),[]),vim:()=>r(()=>import(`./prism-vim-CkRmxTmK.js`),[]),dart:()=>r(()=>import(`./prism-dart-nIH9vDUM.js`),[]),csharp:()=>r(()=>import(`./prism-csharp-C1RDHXRk.js`),[]),protobuf:()=>r(()=>import(`./prism-protobuf-BE1MoFmZ.js`),[]),hcl:()=>r(()=>import(`./prism-hcl-C-ZHJGEE.js`),[]),perl:()=>r(()=>import(`./prism-perl-BBDKnHRR.js`),[]),elixir:()=>r(()=>import(`./prism-elixir-DUMUOd7H.js`),[]),nix:()=>r(()=>import(`./prism-nix-CO4UPu3E.js`),[]),haskell:()=>r(()=>import(`./prism-haskell-BP3SRvzt.js`),[])}[e];if(!t)return console.warn(`No loader available for language: ${e}`),Promise.reject(Error(`Unsupported language: ${e}`));Pn[e]=t().then(()=>void 0).catch(t=>{throw delete Pn[e],console.warn(`Failed to load language: ${e}`,t),t})}return Pn[e]}typeof global<`u`?global.Prism=V:typeof window<`u`&&(window.Prism=V);var In=V,Ln=`markup.html.xml.svg.javascript.js.typescript.ts.jsx.tsx.css.c.cpp.swift.kotlin.objectivec.reason.rust.go.graphql.yaml.yml.json.markdown.md.python.py`.split(`.`);function Rn(e,t){let[n,r]=(0,A.useState)(()=>Ln.includes(t)||!!In.languages[t]);return(0,A.useEffect)(()=>{if(!n){if(Ln.includes(t)){r(!0);return}Fn(t).then(()=>{r(!0)}).catch(()=>{r(!1)})}},[t,n]),{ready:n,actualLang:n?t:`text`}}function zn(e){return e&&e.split(`.`).pop()?.toLowerCase()||null}function Bn(e){return e&&e.split(`/`).pop()||``}var Vn={js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsx:`typescript`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,cpp:`cpp`,c:`c`,cs:`csharp`,php:`php`,swift:`swift`,kt:`kotlin`,scala:`scala`,r:`r`,sql:`sql`,sh:`bash`,bash:`bash`,zsh:`bash`,fish:`bash`,yml:`yaml`,yaml:`yaml`,json:`json`,xml:`xml`,html:`html`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,md:`markdown`,markdown:`markdown`,tex:`latex`,vim:`vim`,ex:`elixir`,exs:`elixir`,heex:`elixir`,nix:`nix`,hs:`haskell`,lhs:`haskell`},Hn={ts:`typescript`,tsx:`tsx`,mts:`typescript`,cts:`typescript`,js:`javascript`,jsx:`jsx`,mjs:`javascript`,cjs:`javascript`,json:`json`,css:`css`,scss:`css`,html:`html`,sh:`bash`,bash:`bash`,zsh:`bash`,fish:`bash`,yml:`yaml`,yaml:`yaml`,md:`markdown`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,cpp:`cpp`,c:`c`,php:`php`,sql:`sql`,xml:`xml`,swift:`swift`,kt:`kotlin`,scala:`scala`,svelte:`svelte`,r:`r`,lua:`lua`,perl:`perl`,pl:`perl`,pm:`perl`,dockerfile:`docker`,makefile:`makefile`,gitignore:`git`,env:`bash`,conf:`nginx`,ini:`ini`,toml:`toml`,sol:`solidity`,vim:`vim`,dart:`dart`,cs:`csharp`,proto:`protobuf`,tf:`hcl`,tfvars:`hcl`,hcl:`hcl`,ex:`elixir`,exs:`elixir`,heex:`elixir`,nix:`nix`,hs:`haskell`,lhs:`haskell`},Un={dockerfile:`docker`,makefile:`makefile`,".gitignore":`git`,".env":`bash`,".bashrc":`bash`,".zshrc":`bash`,".bash_profile":`bash`,".profile":`bash`};function Wn(e,t){if(e)return t[e.toLowerCase()]}function Gn(e){return Wn(zn(e),Vn)}function Kn(e){return Un[Bn(e).toLowerCase()]||Wn(zn(e),Hn)||`text`}function qn(e){return{...e,styles:e.styles.map(e=>({...e,style:{...e.style,background:void 0,backgroundColor:void 0}}))}}function Jn(e){let t;switch(e){case`github`:t=tn.github;break;case`vsLight`:t=tn.vsLight;break;case`oneLight`:t=tn.oneLight;break;case`gruvboxMaterialLight`:t=tn.gruvboxMaterialLight;break;case`nightOwlLight`:t=tn.nightOwlLight;break;case`vsDark`:t=tn.vsDark;break;case`oneDark`:t=tn.oneDark;break;case`gruvboxMaterialDark`:t=tn.gruvboxMaterialDark;break;case`nightOwl`:t=tn.nightOwl;break;case`dracula`:t=tn.dracula;break;case`okaidia`:t=tn.okaidia;break;default:t=tn.vsDark}return qn(t)}var Yn=A.memo(function({code:e,language:t,className:n,syntaxTheme:r=`vsDark`,filename:i=``,renderToken:a,onMouseOver:o,onMouseOut:s}){let{actualLang:c}=Rn(e,t||(i?Kn(i):`text`));return(0,j.jsx)(Nn,{code:e,language:c,theme:Jn(r),prism:In,children:(0,A.useCallback)(({style:e,tokens:t,getLineProps:r,getTokenProps:i})=>(0,j.jsx)(`span`,{className:n,style:{...e,background:`transparent`,backgroundColor:`transparent`},onMouseOver:o,onMouseOut:s,children:t.map((e,t)=>(0,j.jsx)(`span`,{...r({line:e}),children:e.map((e,t)=>a?a(e,t,i):(0,j.jsx)(`span`,{...i({token:e})},t))},t))}),[n,o,s,a])})}),Xn=A.memo(function(e){let{handleMouseOver:t,handleMouseOut:n,isWordHighlighted:r}=Ft(),i=(0,A.useCallback)((e,t,n)=>{let i=n({token:e}),a=e.content.split(/( +)/);if(a.length===1&&a[0]&&!jt(a[0]))return(0,j.jsx)(`span`,{...i},t);let o=a.map((e,n)=>{if(!e)return null;if(jt(e)){let i=e.trim();return(0,j.jsx)(`span`,{className:`word-token ${r(i)?`word-highlight`:``}`,"data-word":i,children:e},`${t}-${n}`)}return(0,j.jsx)(`span`,{children:e},`${t}-${n}`)});return(0,j.jsx)(`span`,{...i,children:o},t)},[r]);return(0,j.jsx)(Yn,{...e,renderToken:i,onMouseOver:t,onMouseOut:n})}),Zn=A.memo(function({segments:e,className:t=``}){return(0,j.jsx)(`span`,{className:t,children:(0,A.useMemo)(()=>e.map((e,t)=>(0,j.jsx)(`span`,{className:e.type===`added`?`word-diff-added`:e.type===`removed`?`word-diff-removed`:``,children:e.value},t)),[e])})}),Qn=e=>{switch(e){case`add`:return`+`;case`delete`:return`-`;default:return` `}},$n=e=>{switch(e){case`add`:return`text-github-accent bg-diff-addition-bg`;case`delete`:return`text-github-danger bg-diff-deletion-bg`;default:return`text-github-text-muted bg-github-bg-secondary`}};function er({line:e,syntaxTheme:t,filename:n,diffSegments:r,showPrefixBorder:i=!0}){return(0,j.jsxs)(`div`,{className:`flex items-center relative min-h-[16px]`,children:[(0,j.jsx)(`span`,{className:`w-5 text-center flex-shrink-0 ${i?`border-r border-github-border`:``} ${$n(e.type)}`,children:Qn(e.type)}),r?(0,j.jsx)(Zn,{segments:r,className:`flex-1 px-3 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text`}):(0,j.jsx)(Xn,{code:e.content,className:`flex-1 px-3 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text [&_pre]:m-0 [&_pre]:p-0 [&_pre]:!bg-transparent [&_pre]:font-inherit [&_pre]:text-inherit [&_pre]:leading-inherit [&_code]:!bg-transparent [&_code]:font-inherit [&_code]:text-inherit [&_code]:leading-inherit`,syntaxTheme:t,filename:n})]})}var tr=e=>e===`add`?`bg-diff-addition-bg`:`bg-diff-deletion-bg`,nr=(e,t)=>({type:e,content:t});function rr({code:e,type:t,filename:n,keyPrefix:r,syntaxTheme:i}){return(0,j.jsx)(j.Fragment,{children:e.split(`
14
+ `,e[0].empty=!0)},On=(e,t)=>{let n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},kn=e=>{let t=[[]],n=[e],r=[0],i=[e.length],a=0,o=0,s=[],c=[s];for(;o>-1;){for(;(a=r[o]++)<i[o];){let e,l=t[o],u=n[o][a];if(typeof u==`string`?(l=o>0?l:[`plain`],e=u):(l=On(l,u.type),u.alias&&(l=On(l,u.alias)),e=u.content),typeof e!=`string`){o++,t.push(l),n.push(e),r.push(0),i.push(e.length);continue}let d=e.split(En),f=d.length;s.push({types:l,content:d[0]});for(let e=1;e<f;e++)Dn(s),c.push(s=[]),s.push({types:l,content:d[e]})}o--,t.pop(),n.pop(),r.pop(),i.pop()}return Dn(s),c},An=({prism:e,code:t,grammar:n,language:r})=>(0,A.useMemo)(()=>{if(n==null)return kn([t]);let i={code:t,grammar:n,language:r,tokens:[]};return e.hooks.run(`before-tokenize`,i),i.tokens=e.tokenize(t,n),e.hooks.run(`after-tokenize`,i),kn(i.tokens)},[t,n,r,e]),jn=(e,t)=>{let{plain:n}=e,r=e.styles.reduce((e,n)=>{let{languages:r,style:i}=n;return r&&!r.includes(t)||n.types.forEach(t=>{e[t]=Yt(Yt({},e[t]),i)}),e},{});return r.root=n,r.plain=Xt(Yt({},n),{backgroundColor:void 0}),r},Mn=({children:e,language:t,code:n,theme:r,prism:i})=>{let a=t.toLowerCase(),o=jn(r,a),s=wn(o),c=Tn(o),l=i.languages[a];return e({tokens:An({prism:i,language:a,code:n,grammar:l}),className:`prism-code language-${a}`,style:o==null?{}:o.root,getLineProps:s,getTokenProps:c})},Nn=e=>(0,A.createElement)(Mn,Xt(Yt({},e),{prism:e.prism||V,theme:e.theme||gn,code:e.code,language:e.language})),Pn={};function Fn(e){if(!Pn[e]){let t={bash:()=>r(()=>import(`./prism-bash-iQBez6et.js`),[]),sh:()=>r(()=>import(`./prism-bash-iQBez6et.js`),[]),shell:()=>r(()=>import(`./prism-bash-iQBez6et.js`),[]),php:async()=>(await r(()=>import(`./prism-markup-templating-h9TC-ifW.js`),[]),r(()=>import(`./prism-php-DcBIrISj.js`),[])),sql:()=>r(()=>import(`./prism-sql-Cz-8DmQS.js`),[]),ruby:()=>r(()=>import(`./prism-ruby-lhDmuasn.js`),[]),java:()=>r(()=>import(`./prism-java-CWuFbfVD.js`),[]),scala:async()=>(await Fn(`java`),r(()=>import(`./prism-scala-YlPat9I4.js`),[])),solidity:()=>r(()=>import(`./prism-solidity-C3nR0EVH.js`),[]),vim:()=>r(()=>import(`./prism-vim-C3oukvmk.js`),[]),dart:()=>r(()=>import(`./prism-dart-CMjMHaBW.js`),[]),csharp:()=>r(()=>import(`./prism-csharp-DAAROvjt.js`),[]),protobuf:()=>r(()=>import(`./prism-protobuf-DuPg7Jbg.js`),[]),hcl:()=>r(()=>import(`./prism-hcl-Du4YC80h.js`),[]),perl:()=>r(()=>import(`./prism-perl-DhcRwJzx.js`),[]),elixir:()=>r(()=>import(`./prism-elixir-B9cwzXs0.js`),[]),nix:()=>r(()=>import(`./prism-nix-CqauNIYa.js`),[]),haskell:()=>r(()=>import(`./prism-haskell-Vgx7BCAm.js`),[]),clojure:()=>r(()=>import(`./prism-clojure-CTkJ-FW_.js`),[])}[e];if(!t)return console.warn(`No loader available for language: ${e}`),Promise.reject(Error(`Unsupported language: ${e}`));Pn[e]=t().then(()=>void 0).catch(t=>{throw delete Pn[e],console.warn(`Failed to load language: ${e}`,t),t})}return Pn[e]}typeof global<`u`?global.Prism=V:typeof window<`u`&&(window.Prism=V);var In=V,Ln=`markup.html.xml.svg.javascript.js.typescript.ts.jsx.tsx.css.c.cpp.swift.kotlin.objectivec.reason.rust.go.graphql.yaml.yml.json.markdown.md.python.py`.split(`.`);function Rn(e,t){let[n,r]=(0,A.useState)(()=>Ln.includes(t)||!!In.languages[t]);return(0,A.useEffect)(()=>{if(!n){if(Ln.includes(t)){r(!0);return}Fn(t).then(()=>{r(!0)}).catch(()=>{r(!1)})}},[t,n]),{ready:n,actualLang:n?t:`text`}}function zn(e){return e&&e.split(`.`).pop()?.toLowerCase()||null}function Bn(e){return e&&e.split(`/`).pop()||``}var Vn={js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsx:`typescript`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,cpp:`cpp`,c:`c`,cs:`csharp`,php:`php`,swift:`swift`,kt:`kotlin`,scala:`scala`,r:`r`,sql:`sql`,sh:`bash`,bash:`bash`,zsh:`bash`,fish:`bash`,yml:`yaml`,yaml:`yaml`,json:`json`,xml:`xml`,html:`html`,css:`css`,scss:`scss`,sass:`sass`,less:`less`,md:`markdown`,markdown:`markdown`,tex:`latex`,vim:`vim`,ex:`elixir`,exs:`elixir`,heex:`elixir`,nix:`nix`,hs:`haskell`,lhs:`haskell`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,edn:`clojure`},Hn={ts:`typescript`,tsx:`tsx`,mts:`typescript`,cts:`typescript`,js:`javascript`,jsx:`jsx`,mjs:`javascript`,cjs:`javascript`,json:`json`,css:`css`,scss:`css`,html:`html`,sh:`bash`,bash:`bash`,zsh:`bash`,fish:`bash`,yml:`yaml`,yaml:`yaml`,md:`markdown`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,cpp:`cpp`,c:`c`,php:`php`,sql:`sql`,xml:`xml`,swift:`swift`,kt:`kotlin`,scala:`scala`,svelte:`svelte`,r:`r`,lua:`lua`,perl:`perl`,pl:`perl`,pm:`perl`,dockerfile:`docker`,makefile:`makefile`,gitignore:`git`,env:`bash`,conf:`nginx`,ini:`ini`,toml:`toml`,sol:`solidity`,vim:`vim`,dart:`dart`,cs:`csharp`,proto:`protobuf`,tf:`hcl`,tfvars:`hcl`,hcl:`hcl`,ex:`elixir`,exs:`elixir`,heex:`elixir`,nix:`nix`,hs:`haskell`,lhs:`haskell`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,edn:`clojure`},Un={dockerfile:`docker`,makefile:`makefile`,".gitignore":`git`,".env":`bash`,".bashrc":`bash`,".zshrc":`bash`,".bash_profile":`bash`,".profile":`bash`};function Wn(e,t){if(e)return t[e.toLowerCase()]}function Gn(e){return Wn(zn(e),Vn)}function Kn(e){return Un[Bn(e).toLowerCase()]||Wn(zn(e),Hn)||`text`}function qn(e){return{...e,styles:e.styles.map(e=>({...e,style:{...e.style,background:void 0,backgroundColor:void 0}}))}}function Jn(e){let t;switch(e){case`github`:t=tn.github;break;case`vsLight`:t=tn.vsLight;break;case`oneLight`:t=tn.oneLight;break;case`gruvboxMaterialLight`:t=tn.gruvboxMaterialLight;break;case`nightOwlLight`:t=tn.nightOwlLight;break;case`vsDark`:t=tn.vsDark;break;case`oneDark`:t=tn.oneDark;break;case`gruvboxMaterialDark`:t=tn.gruvboxMaterialDark;break;case`nightOwl`:t=tn.nightOwl;break;case`dracula`:t=tn.dracula;break;case`okaidia`:t=tn.okaidia;break;default:t=tn.vsDark}return qn(t)}var Yn=A.memo(function({code:e,language:t,className:n,syntaxTheme:r=`vsDark`,filename:i=``,renderToken:a,onMouseOver:o,onMouseOut:s}){let{actualLang:c}=Rn(e,t||(i?Kn(i):`text`));return(0,j.jsx)(Nn,{code:e,language:c,theme:Jn(r),prism:In,children:(0,A.useCallback)(({style:e,tokens:t,getLineProps:r,getTokenProps:i})=>(0,j.jsx)(`span`,{className:n,style:{...e,background:`transparent`,backgroundColor:`transparent`},onMouseOver:o,onMouseOut:s,children:t.map((e,t)=>(0,j.jsx)(`span`,{...r({line:e}),children:e.map((e,t)=>a?a(e,t,i):(0,j.jsx)(`span`,{...i({token:e})},t))},t))}),[n,o,s,a])})}),Xn=A.memo(function(e){let{handleMouseOver:t,handleMouseOut:n,isWordHighlighted:r}=Ft(),i=(0,A.useCallback)((e,t,n)=>{let i=n({token:e}),a=e.content.split(/( +)/);if(a.length===1&&a[0]&&!jt(a[0]))return(0,j.jsx)(`span`,{...i},t);let o=a.map((e,n)=>{if(!e)return null;if(jt(e)){let i=e.trim();return(0,j.jsx)(`span`,{className:`word-token ${r(i)?`word-highlight`:``}`,"data-word":i,children:e},`${t}-${n}`)}return(0,j.jsx)(`span`,{children:e},`${t}-${n}`)});return(0,j.jsx)(`span`,{...i,children:o},t)},[r]);return(0,j.jsx)(Yn,{...e,renderToken:i,onMouseOver:t,onMouseOut:n})}),Zn=A.memo(function({segments:e,className:t=``}){return(0,j.jsx)(`span`,{className:t,children:(0,A.useMemo)(()=>e.map((e,t)=>(0,j.jsx)(`span`,{className:e.type===`added`?`word-diff-added`:e.type===`removed`?`word-diff-removed`:``,children:e.value},t)),[e])})}),Qn=e=>{switch(e){case`add`:return`+`;case`delete`:return`-`;default:return` `}},$n=e=>{switch(e){case`add`:return`text-github-accent bg-diff-addition-bg`;case`delete`:return`text-github-danger bg-diff-deletion-bg`;default:return`text-github-text-muted bg-github-bg-secondary`}};function er({line:e,syntaxTheme:t,filename:n,diffSegments:r,showPrefixBorder:i=!0}){return(0,j.jsxs)(`div`,{className:`flex items-center relative min-h-[16px]`,children:[(0,j.jsx)(`span`,{className:`w-5 text-center flex-shrink-0 ${i?`border-r border-github-border`:``} ${$n(e.type)}`,children:Qn(e.type)}),r?(0,j.jsx)(Zn,{segments:r,className:`flex-1 px-3 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text`}):(0,j.jsx)(Xn,{code:e.content,className:`flex-1 px-3 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text [&_pre]:m-0 [&_pre]:p-0 [&_pre]:!bg-transparent [&_pre]:font-inherit [&_pre]:text-inherit [&_pre]:leading-inherit [&_code]:!bg-transparent [&_code]:font-inherit [&_code]:text-inherit [&_code]:leading-inherit`,syntaxTheme:t,filename:n})]})}var tr=e=>e===`add`?`bg-diff-addition-bg`:`bg-diff-deletion-bg`,nr=(e,t)=>({type:e,content:t});function rr({code:e,type:t,filename:n,keyPrefix:r,syntaxTheme:i}){return(0,j.jsx)(j.Fragment,{children:e.split(`
15
15
  `).map((e,a)=>(0,j.jsx)(`div`,{className:tr(t),children:(0,j.jsx)(er,{line:nr(t,e),filename:n,syntaxTheme:i,showPrefixBorder:!1})},`${r}-${a}`))})}function ir(e){return wt(e)}function ar({body:e,originalCode:t,filename:n,syntaxTheme:r}){return(0,j.jsx)(`div`,{className:`text-github-text-primary text-sm leading-6`,children:(0,A.useMemo)(()=>{let n=Tt(e);if(n.length===0)return[{type:`text`,content:e}];let r=[],i=0;for(let a of n)a.startIndex>i&&r.push({type:`text`,content:e.slice(i,a.startIndex)}),r.push({type:`suggestion`,code:a.suggestedCode,original:t||``}),i=a.endIndex;return i<e.length&&r.push({type:`text`,content:e.slice(i)}),r},[e,t]).map((e,t)=>e.type===`text`?(0,j.jsx)(`span`,{className:`whitespace-pre-wrap`,children:e.content},t):(0,j.jsx)(`div`,{className:`my-2 border border-github-border rounded-md overflow-hidden`,children:(0,j.jsxs)(`div`,{className:`font-mono text-sm`,children:[e.original&&(0,j.jsx)(rr,{code:e.original,type:`delete`,filename:n,keyPrefix:`orig-${t}`,syntaxTheme:r}),(0,j.jsx)(rr,{code:e.code,type:`add`,filename:n,keyPrefix:`sugg-${t}`,syntaxTheme:r})]})},t))})}var or=`text-xs px-3 py-1.5 bg-github-bg-tertiary text-github-text-primary border border-github-border rounded hover:opacity-80 transition-all flex items-center gap-1`;function sr({selectedCode:e,value:t,onChange:n,textareaRef:r,className:i=or}){return e?(0,j.jsxs)(`button`,{type:`button`,onClick:()=>{let i=Et(e),a=r?.current;if(!a){n(`${t}${t?`
16
16
 
17
17
  `:``}${i}\n\n`);return}let o=a.selectionStart,s=a.selectionEnd,c=t.slice(0,o),l=t.slice(s),u=`${c?`
@@ -48,32 +48,32 @@ Error generating stack: `+e.message+`
48
48
  `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
49
49
  `,...a.current()});return/^[\t ]/.test(l)&&(l=Xh(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}ng.peek=rg;function ng(e){return e.value||``}function rg(){return`<`}ig.peek=ag;function ig(e,t,n,r){let i=qh(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function ag(){return`!`}og.peek=sg;function og(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function sg(){return`!`}cg.peek=lg;function cg(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function lg(){return"`"}function ug(e,t){let n=Vl(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}dg.peek=fg;function dg(e,t,n,r){let i=qh(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(ug(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function fg(e,t,n){return ug(e,n)?`<`:`[`}pg.peek=mg;function pg(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function mg(){return`[`}function hg(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function gg(e){let t=hg(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function _g(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function vg(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function yg(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?_g(n):hg(n),s=e.ordered?o===`.`?`)`:`.`:gg(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),vg(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function bg(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function xg(e,t,n,r){let i=bg(n),a=n.bulletCurrent||hg(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Sg(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var Cg=Ap([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function wg(e,t,n,r){return(e.children.some(function(e){return Cg(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Tg(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Eg.peek=Dg;function Eg(e,t,n,r){let i=Tg(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Zh(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Xh(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Zh(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Xh(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Dg(e,t,n){return n.options.strong||`*`}function Og(e,t,n,r){return n.safe(e.value,r)}function kg(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Ag(e,t,n){let r=(vg(n)+(n.options.ruleSpaces?` `:``)).repeat(kg(n));return n.options.ruleSpaces?r.slice(0,-1):r}var jg={blockquote:Lh,break:Vh,code:Gh,definition:Jh,emphasis:Qh,hardBreak:Vh,heading:tg,html:ng,image:ig,imageReference:og,inlineCode:cg,link:dg,linkReference:pg,list:yg,listItem:xg,paragraph:Sg,root:wg,strong:Eg,text:Og,thematicBreak:Ag};function Mg(){return{enter:{table:Ng,tableData:Lg,tableHeader:Lg,tableRow:Fg},exit:{codeText:Rg,table:Pg,tableData:Ig,tableHeader:Ig,tableRow:Ig}}}function Ng(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Pg(e){this.exit(e),this.data.inTable=void 0}function Fg(e){this.enter({type:`tableRow`,children:[]},e)}function Ig(e){this.exit(e)}function Lg(e){this.enter({type:`tableCell`,children:[]},e)}function Rg(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,zg));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function zg(e,t){return t===`|`?t:e}function Bg(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
50
50
  `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
51
- `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Ph(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=jg.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function Vg(){return{exit:{taskListCheckValueChecked:Ug,taskListCheckValueUnchecked:Ug,paragraph:Wg}}}function Hg(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Gg}}}function Ug(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Wg(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Gg(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=jg.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function Kg(){return[Qm(),Sh(),Dh(),Mg(),Vg()]}function qg(e){return{extensions:[$m(),Ch(e),Oh(),Bg(e),Hg()]}}var Jg={tokenize:c_,partial:!0},Yg={tokenize:l_,partial:!0},Xg={tokenize:u_,partial:!0},Zg={tokenize:d_,partial:!0},Qg={tokenize:f_,partial:!0},$g={name:`wwwAutolink`,tokenize:o_,previous:p_},e_={name:`protocolAutolink`,tokenize:s_,previous:m_},t_={name:`emailAutolink`,tokenize:a_,previous:h_},n_={};function r_(){return{text:n_}}for(var i_=48;i_<123;)n_[i_]=t_,i_++,i_===58?i_=65:i_===91&&(i_=97);n_[43]=t_,n_[45]=t_,n_[46]=t_,n_[95]=t_,n_[72]=[t_,e_],n_[104]=[t_,e_],n_[87]=[t_,$g],n_[119]=[t_,$g];function a_(e,t,n){let r=this,i,a;return o;function o(t){return!g_(t)||!h_.call(r,r.previous)||__(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return g_(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Qg,u,l)(t):t===45||t===95||nu(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&tu(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function o_(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!p_.call(r,r.previous)||__(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Jg,e.attempt(Yg,e.attempt(Xg,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function s_(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&m_.call(r,r.previous)&&!__(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(tu(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||iu(t)||X(t)||lu(t)||cu(t)?n(t):e.attempt(Yg,e.attempt(Xg,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function c_(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function l_(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Zg,c,s)(t):t===null||X(t)||lu(t)||t!==45&&cu(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function u_(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Zg,t,a)(o):o===null||X(o)||lu(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function d_(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||X(o)||lu(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||X(e)||lu(e)?t(e):r(e)}function a(e){return tu(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):tu(t)?(e.consume(t),o):n(t)}}function f_(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return nu(e)?n(e):t(e)}}function p_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||X(e)}function m_(e){return!tu(e)}function h_(e){return!(e===47||g_(e))}function g_(e){return e===43||e===45||e===46||e===95||nu(e)}function __(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var v_={tokenize:E_,partial:!0};function y_(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:C_,continuation:{tokenize:w_},exit:T_}},text:{91:{name:`gfmFootnoteCall`,tokenize:S_},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:b_,resolveTo:x_}}}}function b_(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=eu(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function x_(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function S_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||X(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(eu(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return X(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function C_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||X(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=eu(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return X(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Q(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function w_(e,t,n){return e.check(Eu,t,e.attempt(v_,t,n))}function T_(e){e.exit(`gfmFootnoteDefinition`)}function E_(e,t,n){let r=this;return Q(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function D_(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&ql(o,o.length,0,yu(s,e.slice(r+1,n),t)),ql(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),ql(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=vu(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=vu(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var O_=class{constructor(){this.map=[]}add(e,t,n){k_(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function k_(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function A_(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function j_(){return{flow:{null:{name:`table`,tokenize:M_,resolveAll:N_}}}}function M_(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Y(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Z(t)?Q(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||X(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Z(t)?Q(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Z(t)?Q(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Y(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Z(t)?Q(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Y(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Y(n)?(e.exit(`tableRow`),t(n)):Z(n)?Q(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||X(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function N_(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new O_;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(F_(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=P_(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=P_(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=P_(f,t,o,i,n,d)):(o[0]=o[1],d=P_(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&F_(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=A_(t.events,n))}return e}function P_(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},I_(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=I_(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=I_(t.events,n[2]),a=I_(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},I_(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function F_(e,t,n,r,i){let a=[],o=I_(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function I_(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var L_={name:`tasklistCheck`,tokenize:z_};function R_(){return{text:{91:L_}}}function z_(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return X(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Y(r)?t(r):Z(r)?e.check({tokenize:B_},t,n)(r):n(r)}}function B_(e,t,n){return Q(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function V_(e){return Xl([r_(),y_(),D_(e),j_(),R_()])}var H_={};function U_(e){let t=this,n=e||H_,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(V_(n)),a.push(Kg()),o.push(qg(n))}var W_=null,G_=()=>(W_??=r(()=>import(`./mermaid.core-R7nXpPx-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])),W_),K_=e=>e===`light`?`default`:`dark`;function q_({chart:e}){let t=(0,A.useRef)(null),n=(0,A.useId)().replace(/:/g,`-`),[r,i]=(0,A.useState)(()=>h()),[a,o]=(0,A.useState)(null),s=K_(r);return(0,A.useEffect)(()=>{let e=document.documentElement,t=()=>{let e=h();i(t=>t===e?t:e)};t();let n=new MutationObserver(e=>{e.some(e=>e.attributeName===`data-theme`)&&t()});return n.observe(e,{attributes:!0,attributeFilter:[`data-theme`]}),()=>{n.disconnect()}},[]),(0,A.useEffect)(()=>{let r=!1,i=t.current;return(async()=>{if(i){i.innerHTML=``,o(null);try{let{default:t}=await G_();t.initialize({startOnLoad:!1,securityLevel:`strict`,theme:s});let{svg:a,bindFunctions:o}=await t.render(`mermaid-diagram-${n}`,e);if(r)return;i.innerHTML=a,o?.(i)}catch(e){if(r)return;i.innerHTML=``,o(e instanceof Error?e.message:`Failed to render Mermaid diagram`)}}})(),()=>{r=!0,i&&(i.innerHTML=``)}},[e,n,s]),a?(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`div`,{className:`text-sm text-github-danger`,title:a,children:`Unable to render Mermaid diagram.`}),(0,j.jsx)(`pre`,{className:`markdown-preview-code whitespace-pre-wrap border border-github-border bg-github-bg-secondary p-3 overflow-x-auto text-sm font-mono text-github-text-primary`,children:e})]}):(0,j.jsx)(`div`,{ref:t,"aria-label":`Mermaid diagram`,className:`mermaid-diagram overflow-x-auto rounded border border-github-border bg-github-bg-secondary p-3`})}var J_=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends J_{};function Y_(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function X_(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Z_(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Q_(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function $_(e,t){return Z_(e,t,``)}function ev(e,t){return Q_(e,t,``)}function tv(e,t){return t.slice(0,nv(e,t))}function nv(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function rv(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function iv(e,t){if(t)return ov(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function av(e,t){if(t)return ov(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function ov(e,t){if(!t)return[av(e),iv(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=rv(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var sv=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,cv=RegExp(`[${sv}]+|\\s+|[^${sv}]`,`ug`),lv=new class extends J_{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=rv(e,r)}else n=e.match(cv)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&dv(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&dv(n,i,r,null,t.intlSegmenter),e}};function uv(e,t,n){return n?.ignoreWhitespace!=null&&!n.ignoreWhitespace?pv(e,t,n):lv.diff(e,t,n)}function dv(e,t,n,r,i){if(t&&n){let[a,o]=ov(t.value,i),[s,c]=ov(n.value,i);if(e){let r=Y_(a,s);e.value=Q_(e.value,s,r),t.value=$_(t.value,r),n.value=$_(n.value,r)}if(r){let e=X_(o,c);r.value=Z_(r.value,c,e),t.value=ev(t.value,e),n.value=ev(n.value,e)}}else if(n){if(e){let e=av(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=av(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=av(r.value,i),[a,o]=ov(t.value,i),s=Y_(n,a);t.value=$_(t.value,s);let c=X_($_(n,s),o);t.value=ev(t.value,c),r.value=Z_(r.value,n,c),e.value=Q_(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=av(r.value,i),n=tv(iv(t.value,i),e);t.value=ev(t.value,n)}else if(e){let n=tv(iv(e.value,i),av(t.value,i));t.value=$_(t.value,n)}}var fv=new class extends J_{tokenize(e){let t=RegExp(`(\\r?\\n)|[${sv}]+|[^\\S\\n\\r]+|[^${sv}]`,`ug`);return e.match(t)||[]}};function pv(e,t,n){return fv.diff(e,t,n)}var mv=new class extends J_{constructor(){super(...arguments),this.tokenize=gv}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
51
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Ph(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=jg.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function Vg(){return{exit:{taskListCheckValueChecked:Ug,taskListCheckValueUnchecked:Ug,paragraph:Wg}}}function Hg(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Gg}}}function Ug(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Wg(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Gg(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=jg.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function Kg(){return[Qm(),Sh(),Dh(),Mg(),Vg()]}function qg(e){return{extensions:[$m(),Ch(e),Oh(),Bg(e),Hg()]}}var Jg={tokenize:c_,partial:!0},Yg={tokenize:l_,partial:!0},Xg={tokenize:u_,partial:!0},Zg={tokenize:d_,partial:!0},Qg={tokenize:f_,partial:!0},$g={name:`wwwAutolink`,tokenize:o_,previous:p_},e_={name:`protocolAutolink`,tokenize:s_,previous:m_},t_={name:`emailAutolink`,tokenize:a_,previous:h_},n_={};function r_(){return{text:n_}}for(var i_=48;i_<123;)n_[i_]=t_,i_++,i_===58?i_=65:i_===91&&(i_=97);n_[43]=t_,n_[45]=t_,n_[46]=t_,n_[95]=t_,n_[72]=[t_,e_],n_[104]=[t_,e_],n_[87]=[t_,$g],n_[119]=[t_,$g];function a_(e,t,n){let r=this,i,a;return o;function o(t){return!g_(t)||!h_.call(r,r.previous)||__(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return g_(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Qg,u,l)(t):t===45||t===95||nu(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&tu(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function o_(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!p_.call(r,r.previous)||__(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Jg,e.attempt(Yg,e.attempt(Xg,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function s_(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&m_.call(r,r.previous)&&!__(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(tu(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||iu(t)||X(t)||lu(t)||cu(t)?n(t):e.attempt(Yg,e.attempt(Xg,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function c_(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function l_(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Zg,c,s)(t):t===null||X(t)||lu(t)||t!==45&&cu(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function u_(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Zg,t,a)(o):o===null||X(o)||lu(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function d_(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||X(o)||lu(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||X(e)||lu(e)?t(e):r(e)}function a(e){return tu(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):tu(t)?(e.consume(t),o):n(t)}}function f_(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return nu(e)?n(e):t(e)}}function p_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||X(e)}function m_(e){return!tu(e)}function h_(e){return!(e===47||g_(e))}function g_(e){return e===43||e===45||e===46||e===95||nu(e)}function __(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var v_={tokenize:E_,partial:!0};function y_(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:C_,continuation:{tokenize:w_},exit:T_}},text:{91:{name:`gfmFootnoteCall`,tokenize:S_},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:b_,resolveTo:x_}}}}function b_(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=eu(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function x_(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function S_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||X(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(eu(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return X(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function C_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||X(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=eu(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return X(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Q(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function w_(e,t,n){return e.check(Eu,t,e.attempt(v_,t,n))}function T_(e){e.exit(`gfmFootnoteDefinition`)}function E_(e,t,n){let r=this;return Q(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function D_(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&ql(o,o.length,0,yu(s,e.slice(r+1,n),t)),ql(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),ql(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=vu(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=vu(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var O_=class{constructor(){this.map=[]}add(e,t,n){k_(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function k_(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function A_(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function j_(){return{flow:{null:{name:`table`,tokenize:M_,resolveAll:N_}}}}function M_(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Y(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Z(t)?Q(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||X(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Z(t)?Q(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Z(t)?Q(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Y(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Z(t)?Q(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Y(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Y(n)?(e.exit(`tableRow`),t(n)):Z(n)?Q(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||X(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function N_(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new O_;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(F_(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=P_(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=P_(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=P_(f,t,o,i,n,d)):(o[0]=o[1],d=P_(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&F_(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=A_(t.events,n))}return e}function P_(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},I_(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=I_(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=I_(t.events,n[2]),a=I_(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},I_(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function F_(e,t,n,r,i){let a=[],o=I_(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function I_(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var L_={name:`tasklistCheck`,tokenize:z_};function R_(){return{text:{91:L_}}}function z_(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return X(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Y(r)?t(r):Z(r)?e.check({tokenize:B_},t,n)(r):n(r)}}function B_(e,t,n){return Q(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function V_(e){return Xl([r_(),y_(),D_(e),j_(),R_()])}var H_={};function U_(e){let t=this,n=e||H_,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(V_(n)),a.push(Kg()),o.push(qg(n))}var W_=null,G_=()=>(W_??=r(()=>import(`./mermaid.core-R7nXpPx-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])),W_),K_=e=>e===`light`?`default`:`dark`;function q_({chart:e}){let t=(0,A.useRef)(null),n=(0,A.useId)().replace(/:/g,`-`),[r,i]=(0,A.useState)(()=>h()),[a,o]=(0,A.useState)(null),s=K_(r);return(0,A.useEffect)(()=>{let e=document.documentElement,t=()=>{let e=h();i(t=>t===e?t:e)};t();let n=new MutationObserver(e=>{e.some(e=>e.attributeName===`data-theme`)&&t()});return n.observe(e,{attributes:!0,attributeFilter:[`data-theme`]}),()=>{n.disconnect()}},[]),(0,A.useEffect)(()=>{let r=!1,i=t.current;return(async()=>{if(i){i.innerHTML=``,o(null);try{let{default:t}=await G_();t.initialize({startOnLoad:!1,securityLevel:`strict`,theme:s});let{svg:a,bindFunctions:o}=await t.render(`mermaid-diagram-${n}`,e);if(r)return;i.innerHTML=a,o?.(i)}catch(e){if(r)return;i.innerHTML=``,o(e instanceof Error?e.message:`Failed to render Mermaid diagram`)}}})(),()=>{r=!0,i&&(i.innerHTML=``)}},[e,n,s]),a?(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`div`,{className:`text-sm text-github-danger`,title:a,children:`Unable to render Mermaid diagram.`}),(0,j.jsx)(`pre`,{className:`markdown-preview-code whitespace-pre-wrap border border-github-border bg-github-bg-secondary p-3 overflow-x-auto text-sm font-mono text-github-text-primary`,children:e})]}):(0,j.jsx)(`div`,{ref:t,"aria-label":`Mermaid diagram`,className:`mermaid-diagram overflow-x-auto rounded border border-github-border bg-github-bg-secondary p-3`})}var J_=({mode:e,hasFullPreview:t,onModeChange:n})=>(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,j.jsxs)(`button`,{onClick:()=>n(`diff`),className:`px-2 py-1 text-xs font-medium rounded transition-colors duration-200 flex items-center gap-1 cursor-pointer ${e===`diff`?`text-github-text-primary`:`text-github-text-secondary hover:text-github-text-primary`}`,title:`Code Diff`,children:[(0,j.jsx)(Ge,{size:14}),`Diff`]}),(0,j.jsxs)(`button`,{onClick:()=>n(`diff-preview`),className:`px-2 py-1 text-xs font-medium rounded transition-colors duration-200 flex items-center gap-1 cursor-pointer ${e===`diff-preview`?`text-github-text-primary`:`text-github-text-secondary hover:text-github-text-primary`}`,title:`Diff Preview`,children:[(0,j.jsx)(We,{size:14}),`Diff Preview`]}),t&&(0,j.jsxs)(`button`,{onClick:()=>n(`full-preview`),className:`px-2 py-1 text-xs font-medium rounded transition-colors duration-200 flex items-center gap-1 cursor-pointer ${e===`full-preview`?`text-github-text-primary`:`text-github-text-secondary hover:text-github-text-primary`}`,title:`Full Preview`,children:[(0,j.jsx)(We,{size:14}),`Full Preview`]})]}),Y_=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends Y_{};function X_(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Z_(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Q_(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function $_(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function ev(e,t){return Q_(e,t,``)}function tv(e,t){return $_(e,t,``)}function nv(e,t){return t.slice(0,rv(e,t))}function rv(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function iv(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function av(e,t){if(t)return sv(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function ov(e,t){if(t)return sv(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function sv(e,t){if(!t)return[ov(e),av(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=iv(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var cv=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,lv=RegExp(`[${cv}]+|\\s+|[^${cv}]`,`ug`),uv=new class extends Y_{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=iv(e,r)}else n=e.match(lv)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&fv(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&fv(n,i,r,null,t.intlSegmenter),e}};function dv(e,t,n){return n?.ignoreWhitespace!=null&&!n.ignoreWhitespace?mv(e,t,n):uv.diff(e,t,n)}function fv(e,t,n,r,i){if(t&&n){let[a,o]=sv(t.value,i),[s,c]=sv(n.value,i);if(e){let r=X_(a,s);e.value=$_(e.value,s,r),t.value=ev(t.value,r),n.value=ev(n.value,r)}if(r){let e=Z_(o,c);r.value=Q_(r.value,c,e),t.value=tv(t.value,e),n.value=tv(n.value,e)}}else if(n){if(e){let e=ov(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=ov(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=ov(r.value,i),[a,o]=sv(t.value,i),s=X_(n,a);t.value=ev(t.value,s);let c=Z_(ev(n,s),o);t.value=tv(t.value,c),r.value=Q_(r.value,n,c),e.value=$_(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=ov(r.value,i),n=nv(av(t.value,i),e);t.value=tv(t.value,n)}else if(e){let n=nv(av(e.value,i),ov(t.value,i));t.value=ev(t.value,n)}}var pv=new class extends Y_{tokenize(e){let t=RegExp(`(\\r?\\n)|[${cv}]+|[^\\S\\n\\r]+|[^${cv}]`,`ug`);return e.match(t)||[]}};function mv(e,t,n){return pv.diff(e,t,n)}var hv=new class extends Y_{constructor(){super(...arguments),this.tokenize=_v}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
52
52
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
53
53
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
54
54
  `)&&(e=e.slice(0,-1)),t.endsWith(`
55
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function hv(e,t,n){return mv.diff(e,t,n)}function gv(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
56
- `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function _v(e){return e==`.`||e==`!`||e==`?`}new class extends J_{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(_v(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends J_{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends J_{constructor(){super(...arguments),this.tokenize=gv}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(vv(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function vv(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=vv(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=vv(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends J_{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function yv(e,t){let n=pv(e,t),r=[],i=[];for(let e of n)e.added?i.push({value:e.value,type:`added`}):e.removed?r.push({value:e.value,type:`removed`}):(r.push({value:e.value,type:`unchanged`}),i.push({value:e.value,type:`unchanged`}));return{oldSegments:r,newSegments:i}}function bv(e,t){if(!e.trim()||!t.trim()||e===t)return!1;let n=uv(e,t),r=0,i=0;for(let e of n)i+=e.value.length,!e.added&&!e.removed&&(r+=e.value.length);return r/i>=.2}var xv=A.memo(({onMouseDown:e,onMouseUp:t,title:n=`Add a comment`})=>(0,j.jsx)(`button`,{className:`absolute -right-2 top-1/2 -translate-y-1/2 w-7 h-7 flex items-center justify-center rounded transition-all duration-150 hover:scale-110 z-10`,"data-comment-button":`true`,style:{backgroundColor:`var(--color-yellow-btn-bg)`,color:`var(--color-yellow-btn-text)`,border:`1px solid var(--color-yellow-btn-border)`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`var(--color-yellow-btn-hover-bg)`,e.currentTarget.style.borderColor=`var(--color-yellow-btn-hover-border)`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`var(--color-yellow-btn-bg)`,e.currentTarget.style.borderColor=`var(--color-yellow-btn-border)`},onMouseDown:e,onMouseUp:t,title:n,children:(0,j.jsx)(nt,{className:`w-4 h-4`})}));xv.displayName=`CommentButton`;var Sv=A.memo(({onClick:e,title:t=`Open in editor`,className:n})=>(0,j.jsx)(`button`,{className:`absolute -right-10 top-1/2 -translate-y-1/2 w-7 h-7 flex items-center justify-center rounded transition-all duration-150 hover:scale-110 z-10 ${n||``}`,"data-open-in-editor-button":`true`,style:{backgroundColor:`var(--color-editor-btn-bg)`,color:`var(--color-editor-btn-text)`,border:`1px solid var(--color-editor-btn-border)`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`var(--color-editor-btn-hover-bg)`,e.currentTarget.style.borderColor=`var(--color-editor-btn-hover-border)`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`var(--color-editor-btn-bg)`,e.currentTarget.style.borderColor=`var(--color-editor-btn-border)`},onMouseDown:e=>{e.stopPropagation()},onClick:t=>{t.stopPropagation(),e(t)},title:t,children:(0,j.jsx)(Ue,{className:`w-4 h-4 opacity-80`})}));Sv.displayName=`OpenInEditorButton`;var Cv=e=>{if(`isExpanded`in e&&e.isExpanded)return`bg-github-bg-tertiary/80`;switch(e.type){case`add`:return`bg-diff-addition-bg`;case`delete`:return`bg-diff-deletion-bg`;default:return`bg-transparent`}},wv=A.memo(({line:e,index:t,lineId:n,isCurrentLine:r=!1,hoveredLineIndex:i,selectedLineStyle:a,onMouseEnter:o,onMouseLeave:s,onMouseMove:c,onCommentButtonMouseDown:l,onCommentButtonMouseUp:u,onOpenInEditor:d,syntaxTheme:f,onClick:p,filename:m,diffSegments:h})=>{let g=e.newLineNumber||e.oldLineNumber,_=i===t&&g,v=r?`keyboard-cursor`:``;return(0,j.jsxs)(`tr`,{id:n,className:`group ${Cv(e)} relative ${a} ${v} cursor-pointer`,onMouseEnter:o,onMouseLeave:s,onMouseMove:c,onClick:p,children:[(0,j.jsx)(`td`,{className:`w-[var(--line-number-width)] min-w-[var(--line-number-width)] max-w-[var(--line-number-width)] px-2 text-right text-github-text-muted bg-github-bg-secondary border-r border-github-border select-none align-top relative`,children:e.oldLineNumber||``}),(0,j.jsxs)(`td`,{className:`w-[var(--line-number-width)] min-w-[var(--line-number-width)] max-w-[var(--line-number-width)] px-2 text-right text-github-text-muted bg-github-bg-secondary border-r border-github-border select-none align-top relative overflow-visible`,children:[(0,j.jsx)(`span`,{children:e.newLineNumber||``}),_&&(0,j.jsxs)(j.Fragment,{children:[d&&(0,j.jsx)(Sv,{onClick:d}),(0,j.jsx)(xv,{onMouseDown:l,onMouseUp:u})]})]}),(0,j.jsx)(`td`,{className:`p-0 w-full relative align-top`,children:(0,j.jsx)(er,{line:e,syntaxTheme:f,filename:m,diffSegments:h})})]})});wv.displayName=`DiffLineRow`;var Tv=e=>e!==void 0&&`isExpanded`in e&&e.isExpanded===!0,Ev=(e,t)=>t?`bg-github-bg-tertiary/80`:e?.type===`delete`?`bg-diff-deletion-bg`:e?.type===`add`?`bg-diff-addition-bg`:e?.type===`normal`?`bg-transparent`:`bg-github-bg-secondary`;function Dv({chunk:e,chunkIndex:t,threads:n,showAuthorBadges:r=!1,onAddComment:i,onGenerateThreadPrompt:a,onRemoveThread:o,onReplyToThread:s,onRemoveMessage:c,onUpdateMessage:l,syntaxTheme:u,cursor:d=null,fileIndex:f=0,onLineClick:p,commentTrigger:m,onCommentTriggerHandled:h,filename:g,onOpenInEditor:_}){let[v,y]=(0,A.useState)(null),[b,x]=(0,A.useState)(null),[S,C]=(0,A.useState)(!1),[w,T]=(0,A.useState)(null),[E,D]=(0,A.useState)(null);(0,A.useEffect)(()=>{if(m?.lineIndex!==void 0){let t=e.lines[m.lineIndex];if(t&&t.type!==`delete`){let e=t.newLineNumber;e&&(T({side:`new`,lineNumber:e}),h?.())}}},[m,e.lines,h]),(0,A.useEffect)(()=>{if(S){let e=()=>{C(!1),y(null),x(null)};return document.addEventListener(`mouseup`,e),()=>{document.removeEventListener(`mouseup`,e)}}},[S]);let O=(0,A.useCallback)((e,t)=>{w?.side===e&&w?.lineNumber===t?T(null):T({side:e,lineNumber:t})},[w]),k=(0,A.useCallback)(()=>{T(null)},[]),M=(0,A.useCallback)(()=>{if(!w)return``;let{side:t,lineNumber:n}=w,r=e.lines;if(typeof n==`number`)return r.find(e=>t===`old`?e.oldLineNumber===n:e.newLineNumber===n)?.content?.replace(/^[+-]/,``)||``;{let[e,i]=n;return r.filter(n=>{let r=t===`old`?n.oldLineNumber:n.newLineNumber;return r!==void 0&&r>=e&&r<=i}).map(e=>e.content?.replace(/^[+-]/,``)||``).join(`
57
- `)}},[w,e.lines]),N=(0,A.useCallback)(async e=>{if(w!==null){let t=M();await i(w.lineNumber,e,t||void 0,w.side),T(null)}},[w,i,M]),P=(e,t)=>n.filter(n=>{let r=Array.isArray(n.line)?n.line[1]===e:n.line===e,i=!n.side||n.side===t;return r&&i}).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)),ee=e=>e.oldLine?.type===`delete`&&e.newLine?.type===`add`?e.newLineNumber?`right`:`left`:e.oldLine?.type===`delete`?`left`:e.newLine?.type===`add`?`right`:`full`,F=(e,t)=>{let n=e===`old`?t.oldLineNumber:t.newLineNumber;if(!n)return``;if(S&&v&&b&&v.side===e&&b.side===e){let e=Math.min(v.lineNumber,b.lineNumber),t=Math.max(v.lineNumber,b.lineNumber);if(n>=e&&n<=t){let r=`after:bg-blue-100 after:absolute after:inset-0 after:opacity-30 after:border-l-4 after:border-blue-500 after:pointer-events-none`;return n===e&&(r+=` after:border-t-2`),n===t&&(r+=` after:border-b-2`),r}}if(w&&w.side===e){let e=Array.isArray(w.lineNumber)?w.lineNumber:[w.lineNumber,w.lineNumber],t=e[0],r=e[1];if(t!==void 0&&r!==void 0&&n>=t&&n<=r)return`after:bg-diff-selected-bg after:absolute after:inset-0 after:border-l-5 after:border-l-diff-selected-border after:pointer-events-none`}return``},I=(0,A.useCallback)(t=>{let n=[],r=e.oldStart,i=e.newStart,a=0;for(;a<t.length;){let e=t[a];if(!e){a++;continue}if(e.type===`normal`)n.push({oldLine:e,newLine:{...e},oldLineNumber:e.oldLineNumber??r,newLineNumber:e.newLineNumber??i,oldLineOriginalIndex:a,newLineOriginalIndex:a}),r++,i++,a++;else if(e.type===`delete`){let e=a+1;for(;e<t.length&&t[e]?.type===`delete`;)e++;let o=t.slice(a,e),s=a,c=[],l=e;for(;e<t.length&&t[e]?.type===`add`;){let n=t[e];n&&c.push(n),e++}let u=Math.max(o.length,c.length);for(let e=0;e<u;e++){let t=o[e],a=c[e],u;t&&a&&bv(t.content,a.content)&&(u=yv(t.content,a.content)),n.push({oldLine:t,newLine:a,oldLineNumber:t?t.oldLineNumber??r+e:void 0,newLineNumber:a?a.newLineNumber??i+e:void 0,oldLineOriginalIndex:t?s+e:void 0,newLineOriginalIndex:a?l+e:void 0,wordLevelDiff:u})}r+=o.length,i+=c.length,a=e}else e.type===`add`&&(n.push({newLine:e,newLineNumber:e.newLineNumber??i,newLineOriginalIndex:a}),i++,a++)}return n},[e.oldStart,e.newStart]);return(0,j.jsx)(`div`,{className:`bg-github-bg-primary overflow-hidden`,children:(0,j.jsx)(`table`,{className:`w-full table-fixed border-collapse font-mono text-sm leading-5`,children:(0,j.jsx)(`tbody`,{children:(0,A.useMemo)(()=>I(e.lines),[e.lines,I]).map((e,n)=>{let i=e.oldLineNumber?P(e.oldLineNumber,`old`):[],m=e.newLineNumber?P(e.newLineNumber,`new`):[],h=[...i,...m],T=e.oldLineOriginalIndex??-1,I=e.newLineOriginalIndex??-1,te=d?d.side===`left`&&T>=0?d.chunkIndex===t&&d.lineIndex===T:d.side===`right`&&I>=0?d.chunkIndex===t&&d.lineIndex===I:!1:!1,ne=T>=0?`file-${f}-chunk-${t}-line-${T}-left`:void 0,re=I>=0?`file-${f}-chunk-${t}-line-${I}-right`:void 0,L=te&&d?.side===`left`,ie=te&&d?.side===`right`,R=`keyboard-cursor`;return(0,j.jsxs)(A.Fragment,{children:[(0,j.jsxs)(`tr`,{className:`group cursor-pointer`,onClick:e=>{if(!S){let n=e.target;if(!(n instanceof HTMLElement))return;let r=n.closest(`td:nth-child(1)`)||n.closest(`td:nth-child(2)`),i=n.closest(`td:nth-child(3)`)||n.closest(`td:nth-child(4)`);r&&T>=0?p?.(f,t,T,`left`):i&&I>=0&&p?.(f,t,I,`right`)}},onMouseEnter:t=>{let n=t.target;if(!(n instanceof HTMLElement))return;let r=n.closest(`td:nth-child(1)`)||n.closest(`td:nth-child(2)`),i=n.closest(`td:nth-child(3)`)||n.closest(`td:nth-child(4)`);r&&e.oldLineNumber?D({side:`old`,lineNumber:e.oldLineNumber}):i&&e.newLineNumber&&D({side:`new`,lineNumber:e.newLineNumber})},onMouseMove:t=>{let n=t.target;if(!(n instanceof HTMLElement))return;let r=n.closest(`td:nth-child(1)`)||n.closest(`td:nth-child(2)`),i=n.closest(`td:nth-child(3)`)||n.closest(`td:nth-child(4)`);r&&e.oldLineNumber?(E?.side!==`old`||E?.lineNumber!==e.oldLineNumber)&&D({side:`old`,lineNumber:e.oldLineNumber}):i&&e.newLineNumber&&(E?.side!==`new`||E?.lineNumber!==e.newLineNumber)&&D({side:`new`,lineNumber:e.newLineNumber}),S&&v&&(v.side===`old`&&e.oldLineNumber?x({side:`old`,lineNumber:e.oldLineNumber}):v.side===`new`&&e.newLineNumber&&x({side:`new`,lineNumber:e.newLineNumber}))},onMouseLeave:()=>D(null),children:[(0,j.jsxs)(`td`,{id:ne,className:`w-[var(--line-number-width)] min-w-[var(--line-number-width)] max-w-[var(--line-number-width)] px-2 text-right text-github-text-muted bg-github-bg-secondary border-r border-github-border select-none align-top relative overflow-visible ${L?R:``}`,children:[(0,j.jsx)(`span`,{children:e.oldLineNumber||``}),E?.side===`old`&&E?.lineNumber===e.oldLineNumber&&(0,j.jsxs)(j.Fragment,{children:[_&&g&&e.oldLine?.type!==`delete`&&e.newLineNumber!==void 0&&(0,j.jsx)(Sv,{onClick:()=>{let t=e.newLineNumber;!g||t===void 0||_(g,t)}}),(0,j.jsx)(xv,{onMouseDown:t=>{t.stopPropagation(),e.oldLineNumber&&(y({side:`old`,lineNumber:e.oldLineNumber}),x({side:`old`,lineNumber:e.oldLineNumber}),C(!0))},onMouseUp:t=>{if(t.stopPropagation(),!e.oldLineNumber||!v){C(!1),y(null),x(null);return}let n=b&&b.side===`old`?b.lineNumber:e.oldLineNumber;v.side!==`old`||v.lineNumber===n?O(`old`,e.oldLineNumber):O(`old`,[Math.min(v.lineNumber,n),Math.max(v.lineNumber,n)]),C(!1),y(null),x(null)}})]})]}),(0,j.jsx)(`td`,{className:`w-1/2 p-0 align-top border-r border-github-border relative ${Ev(e.oldLine,Tv(e.oldLine))} ${F(`old`,e)} ${L?R:``}`,children:e.oldLine&&(0,j.jsx)(`div`,{className:`flex items-center relative min-h-[20px] px-3`,children:e.wordLevelDiff?(0,j.jsx)(Zn,{segments:e.wordLevelDiff.oldSegments,className:`flex-1 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text`}):(0,j.jsx)(Xn,{code:e.oldLine.content,className:`flex-1 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text [&_pre]:m-0 [&_pre]:p-0 [&_pre]:!bg-transparent [&_pre]:font-inherit [&_pre]:text-inherit [&_pre]:leading-inherit [&_code]:!bg-transparent [&_code]:font-inherit [&_code]:text-inherit [&_code]:leading-inherit`,syntaxTheme:u,filename:g})})}),(0,j.jsxs)(`td`,{id:re,className:`w-[var(--line-number-width)] min-w-[var(--line-number-width)] max-w-[var(--line-number-width)] px-2 text-right text-github-text-muted bg-github-bg-secondary border-r border-github-border select-none align-top relative overflow-visible ${ie?R:``}`,children:[(0,j.jsx)(`span`,{children:e.newLineNumber||``}),E?.side===`new`&&E?.lineNumber===e.newLineNumber&&(0,j.jsxs)(j.Fragment,{children:[_&&g&&e.newLineNumber!==void 0&&(0,j.jsx)(Sv,{onClick:()=>{let t=e.newLineNumber;!g||t===void 0||_(g,t)}}),(0,j.jsx)(xv,{onMouseDown:t=>{t.stopPropagation(),e.newLineNumber&&(y({side:`new`,lineNumber:e.newLineNumber}),x({side:`new`,lineNumber:e.newLineNumber}),C(!0))},onMouseUp:t=>{if(t.stopPropagation(),!e.newLineNumber||!v){C(!1),y(null),x(null);return}let n=b&&b.side===`new`?b.lineNumber:e.newLineNumber;v.side!==`new`||v.lineNumber===n?O(`new`,e.newLineNumber):O(`new`,[Math.min(v.lineNumber,n),Math.max(v.lineNumber,n)]),C(!1),y(null),x(null)}})]})]}),(0,j.jsx)(`td`,{className:`w-1/2 p-0 align-top relative ${Ev(e.newLine,Tv(e.newLine))} ${F(`new`,e)} ${ie?R:``}`,children:e.newLine&&(0,j.jsx)(`div`,{className:`flex items-center relative min-h-[20px] px-3`,children:e.wordLevelDiff?(0,j.jsx)(Zn,{segments:e.wordLevelDiff.newSegments,className:`flex-1 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text`}):(0,j.jsx)(Xn,{code:e.newLine.content,className:`flex-1 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text [&_pre]:m-0 [&_pre]:p-0 [&_pre]:!bg-transparent [&_pre]:font-inherit [&_pre]:text-inherit [&_pre]:leading-inherit [&_code]:!bg-transparent [&_code]:font-inherit [&_code]:text-inherit [&_code]:leading-inherit`,syntaxTheme:u,filename:g})})})]}),h.length>0&&(0,j.jsx)(`tr`,{className:`bg-github-bg-secondary`,children:(0,j.jsx)(`td`,{colSpan:4,className:`p-0 border-t border-github-border`,children:h.map(t=>{let n=t.side||`new`,i;return i=n===`old`&&e.oldLineNumber?`left`:n===`new`&&e.newLineNumber?`right`:ee(e),(0,j.jsx)(`div`,{className:`flex ${i===`left`?`justify-start`:i===`right`?`justify-end`:`justify-center`}`,children:(0,j.jsx)(`div`,{className:`${i===`full`?`w-full`:`w-1/2`}`,children:(0,j.jsx)(`div`,{className:`m-2 mx-3`,children:(0,j.jsx)(ur,{thread:t,showAuthorBadges:r,onGeneratePrompt:a,onRemoveThread:o,onReplyToThread:s,onRemoveMessage:c,onUpdateMessage:l,syntaxTheme:u})})})},t.id)})})}),w&&(w.side===`old`&&w.lineNumber===e.oldLineNumber||w.side===`new`&&w.lineNumber===e.newLineNumber||Array.isArray(w.lineNumber)&&(w.side===`new`&&w.lineNumber[1]===e.newLineNumber||w.side===`old`&&w.lineNumber[1]===e.oldLineNumber))&&(0,j.jsx)(`tr`,{className:`bg-github-bg-secondary`,children:(0,j.jsx)(`td`,{colSpan:4,className:`p-0`,children:(0,j.jsx)(`div`,{className:`flex ${w.side===`old`?`justify-start`:w.side===`new`?`justify-end`:`justify-center`}`,children:(0,j.jsx)(`div`,{className:`w-1/2`,children:(0,j.jsx)(cr,{onSubmit:N,onCancel:k,selectedCode:M(),syntaxTheme:u,filename:g})})})})})]},n)})})})})}var Ov=(0,A.memo)(function({chunk:e,chunkIndex:t,threads:n,showAuthorBadges:r=!1,onAddComment:i,onGenerateThreadPrompt:a,onRemoveThread:o,onReplyToThread:s,onRemoveMessage:c,onUpdateMessage:l,mode:u=mt,syntaxTheme:d,cursor:f=null,fileIndex:p=0,onLineClick:m,commentTrigger:h,onCommentTriggerHandled:g,filename:_,onOpenInEditor:v}){let[y,b]=(0,A.useState)(null),[x,S]=(0,A.useState)(null),[C,w]=(0,A.useState)(!1),[T,E]=(0,A.useState)(null),[D,O]=(0,A.useState)(null);(0,A.useEffect)(()=>{if(h?.lineIndex!==void 0){let t=e.lines[h.lineIndex];if(t){let e=t.newLineNumber||t.oldLineNumber,n=t.type===`delete`?`old`:`new`;e&&(E({side:n,lineNumber:e}),g?.())}}},[h,e.lines,g]),(0,A.useEffect)(()=>{if(C){let e=()=>{w(!1),b(null),S(null)};return document.addEventListener(`mouseup`,e),()=>{document.removeEventListener(`mouseup`,e)}}},[C]);let k=(0,A.useCallback)((e,t)=>{T?.side===e&&T?.lineNumber===t?E(null):E({side:e,lineNumber:t})},[T]),M=(0,A.useCallback)(()=>{E(null)},[]),N=(0,A.useCallback)(()=>{if(!T)return``;let{side:t,lineNumber:n}=T,r=e.lines;if(typeof n==`number`)return r.find(e=>t===`old`?e.oldLineNumber===n:e.newLineNumber===n)?.content?.replace(/^[+-]/,``)||``;{let[e,i]=n;return r.filter(n=>{let r=t===`old`?n.oldLineNumber:n.newLineNumber;return r!==void 0&&r>=e&&r<=i}).map(e=>e.content?.replace(/^[+-]/,``)||``).join(`
58
- `)}},[T,e.lines]),P=(0,A.useCallback)(async e=>{if(T!==null){let t=N();await i(T.lineNumber,e,t||void 0,T.side),E(null)}},[T,i,N]),ee=(e,t)=>n.filter(n=>{let r=Array.isArray(n.line)?n.line[1]===e:n.line===e,i=!n.side||n.side===t;return r&&i}).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)),F=e=>{if(u===`unified`)return`full`;switch(e.type){case`delete`:return`left`;case`add`:return`right`;default:return`full`}},I=(e,t)=>{if(!e)return``;if(C&&y&&x){let t=Math.min(y,x),n=Math.max(y,x);if(e>=t&&e<=n){let r=`after:bg-blue-100 after:absolute after:inset-0 after:opacity-30 after:border-l-4 after:border-blue-500 after:pointer-events-none`;return e===t&&(r+=` after:border-t-2`),e===n&&(r+=` after:border-b-2`),r}}if(T&&T.side===t){let t=Array.isArray(T.lineNumber)?T.lineNumber[0]:T.lineNumber,n=Array.isArray(T.lineNumber)?T.lineNumber[1]:T.lineNumber;if(e>=t&&e<=n)return`after:bg-diff-selected-bg after:absolute after:inset-0 after:border-l-5 after:border-l-diff-selected-border after:pointer-events-none`}return``},te=(0,A.useMemo)(()=>{let t=new Map,n=e.lines,r=0;for(;r<n.length;){let e=n[r];if(!e){r++;continue}if(e.type===`delete`){let e=r+1;for(;e<n.length&&n[e]?.type===`delete`;)e++;let i=n.slice(r,e),a=r,o=[];for(;e<n.length&&n[e]?.type===`add`;){let t=n[e];t&&o.push({line:t,index:e}),e++}let s=Math.max(i.length,o.length);for(let e=0;e<s;e++){let n=i[e],r=o[e];if(n&&r&&bv(n.content,r.line.content)){let i=yv(n.content,r.line.content);t.set(a+e,i.oldSegments),t.set(r.index,i.newSegments)}}r=e}else r++}return t},[e.lines]);return u===`split`?(0,j.jsx)(Dv,{chunk:e,chunkIndex:t,threads:n,showAuthorBadges:r,onAddComment:i,onGenerateThreadPrompt:a,onRemoveThread:o,onReplyToThread:s,onRemoveMessage:c,onUpdateMessage:l,onOpenInEditor:v,syntaxTheme:d,cursor:f,fileIndex:p,onLineClick:m,filename:_,commentTrigger:h,onCommentTriggerHandled:g}):(0,j.jsx)(`div`,{className:`bg-github-bg-primary`,children:(0,j.jsx)(`table`,{className:`w-full table-fixed border-collapse font-mono text-sm leading-5`,children:(0,j.jsx)(`tbody`,{children:e.lines.map((e,n)=>{let i=e.newLineNumber||e.oldLineNumber||0,u=e.type===`delete`?`old`:`new`,h=T?Array.isArray(T.lineNumber)?T.lineNumber[1]:T.lineNumber:null,g=e.type===`delete`?e.oldLineNumber:e.newLineNumber,E=e.type===`delete`?`old`:`new`,ne=g?ee(g,E):[],re=`file-${p}-chunk-${t}-line-${n}`,L=f&&f.chunkIndex===t&&f.lineIndex===n;return(0,j.jsxs)(A.Fragment,{children:[(0,j.jsx)(wv,{line:e,index:n,lineId:re,isCurrentLine:L||!1,hoveredLineIndex:D,selectedLineStyle:I(e.newLineNumber||e.oldLineNumber,e.type===`delete`?`old`:`new`),onMouseEnter:()=>{O(n)},onMouseLeave:()=>O(null),onMouseMove:()=>{if(C&&y){let t=e.newLineNumber||e.oldLineNumber;t&&S(t)}},onCommentButtonMouseDown:t=>{t.stopPropagation();let n=e.newLineNumber||e.oldLineNumber;n&&(b(n),S(n),w(!0))},onCommentButtonMouseUp:t=>{t.stopPropagation();let n=e.newLineNumber||e.oldLineNumber,r=e.type===`delete`?`old`:`new`;if(!n||!y){w(!1),b(null),S(null);return}let i=x||n;y===i?k(r,n):k(r,[Math.min(y,i),Math.max(y,i)]),w(!1),b(null),S(null)},onOpenInEditor:v&&_&&e.type!==`delete`&&(e.newLineNumber||e.oldLineNumber)?()=>{let t=e.newLineNumber||e.oldLineNumber;t&&_&&v(_,t)}:void 0,syntaxTheme:d,filename:_,diffSegments:te.get(n),onClick:()=>{let r=e.type===`delete`?`left`:`right`;m?.(p,t,n,r)}}),ne.map(t=>{let n=F(e);return(0,j.jsx)(`tr`,{className:`bg-github-bg-secondary`,children:(0,j.jsx)(`td`,{colSpan:3,className:`p-0 border-t border-github-border`,children:(0,j.jsx)(`div`,{className:`flex ${n===`left`?`justify-start`:n===`right`?`justify-end`:`justify-center`}`,children:(0,j.jsx)(`div`,{className:`${n===`full`?`w-full`:`w-1/2`} m-2 mx-4`,children:(0,j.jsx)(ur,{thread:t,showAuthorBadges:r,onGeneratePrompt:a,onRemoveThread:o,onReplyToThread:s,onRemoveMessage:c,onUpdateMessage:l,syntaxTheme:d})})})})},t.id)}),T&&T.side===u&&h===i&&(0,j.jsx)(`tr`,{className:`bg-[var(--bg-secondary)]`,children:(0,j.jsx)(`td`,{colSpan:3,className:`p-0`,children:(0,j.jsx)(`div`,{className:`flex ${F(e)===`left`?`justify-start`:F(e)===`right`?`justify-end`:`justify-center`}`,children:(0,j.jsx)(`div`,{className:`${F(e)===`full`?`w-full`:`w-1/2`}`,children:(0,j.jsx)(cr,{onSubmit:P,onCancel:M,selectedCode:N(),syntaxTheme:d,filename:_})})})})})]},n)})})})})}),kv=20,Av=(0,A.memo)(function({direction:e,hiddenLines:t,onExpandUp:n,onExpandDown:r,onExpandAll:i,isLoading:a=!1}){if(t<=0)return null;let o=`${t} ${t===1?`line`:`lines`}`,s=t<=kv,c=[];return s?c.push({key:`all`,onClick:i,ariaLabel:`Expand all ${t} hidden lines`,icon:(0,j.jsx)(ft,{size:16,"aria-hidden":`true`})}):((e===`up`||e===`both`)&&c.push({key:`up`,onClick:n,ariaLabel:`Expand ${kv} hidden lines above`,icon:(0,j.jsx)(Me,{size:12,"aria-hidden":`true`,className:`translate-y-0.5`})}),(e===`down`||e===`both`)&&c.push({key:`down`,onClick:r,ariaLabel:`Expand ${kv} hidden lines below`,icon:(0,j.jsx)(je,{size:12,"aria-hidden":`true`,className:`-translate-y-0.5`})})),(0,j.jsxs)(`div`,{className:`grid w-full border-l border-r border-github-border bg-github-bg-tertiary text-sm grid-cols-[var(--line-number-width)_1fr]`,children:[(0,j.jsx)(`div`,{className:`flex flex-col items-stretch justify-center gap-0.5 border-r border-github-border`,children:a?(0,j.jsx)(et,{size:14,className:`animate-spin text-github-text-muted self-center`,"aria-hidden":`true`}):c.map(e=>(0,j.jsx)(`button`,{type:`button`,onClick:e.onClick,disabled:a||!e.onClick,className:`flex flex-1 w-full items-center justify-center py-1 text-github-text-primary hover:bg-github-bg-secondary hover:text-github-text-muted transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed`,title:e.ariaLabel,"aria-label":e.ariaLabel,children:e.icon},e.key))}),(0,j.jsx)(`div`,{className:`flex items-center justify-start px-3 py-1.5 font-mono text-github-text-muted select-none`,children:o})]})});function jv({file:e,threads:t,showAuthorBadges:n,diffMode:r,syntaxTheme:i,cursor:a,fileIndex:o,mergedChunks:s,isExpandLoading:c,expandHiddenLines:l,expandAllBetweenChunks:u,onAddComment:d,onGenerateThreadPrompt:f,onRemoveThread:p,onReplyToThread:m,onRemoveMessage:h,onUpdateMessage:g,onLineClick:_,onOpenInEditor:v,commentTrigger:y,onCommentTriggerHandled:b}){let x=(t,n,r,i)=>t===`top`&&n.hiddenLinesBefore>0?(0,j.jsx)(Av,{direction:`down`,hiddenLines:n.hiddenLinesBefore,onExpandDown:()=>l(e,r,`up`),onExpandAll:()=>u(e,r,n.hiddenLinesBefore),isLoading:c}):t===`middle`&&n.hiddenLinesBefore>0?(0,j.jsx)(Av,{direction:`both`,hiddenLines:n.hiddenLinesBefore,onExpandUp:()=>l(e,r-1,`down`),onExpandDown:()=>l(e,r,`up`),onExpandAll:()=>u(e,r,n.hiddenLinesBefore),isLoading:c}):t===`bottom`&&n.hiddenLinesAfter>0?(0,j.jsx)(Av,{direction:`up`,hiddenLines:n.hiddenLinesAfter,onExpandUp:()=>l(e,i,`down`),onExpandAll:()=>l(e,i,`down`,n.hiddenLinesAfter),isLoading:c}):null;return(0,j.jsx)(j.Fragment,{children:s.map((c,l)=>{let u=l===0,S=l===s.length-1,C=c.originalIndices[0]??0,w=c.originalIndices[c.originalIndices.length-1]??0;return(0,j.jsxs)(A.Fragment,{children:[u&&x(`top`,c,C,w),!u&&x(`middle`,c,C,w),(0,j.jsx)(`div`,{id:`chunk-${e.path.replace(/[^a-zA-Z0-9]/g,`-`)}-${l}`,children:(0,j.jsx)(Ov,{chunk:c,chunkIndex:l,threads:t,showAuthorBadges:n,onAddComment:d,onGenerateThreadPrompt:f,onRemoveThread:p,onReplyToThread:m,onRemoveMessage:h,onUpdateMessage:g,onOpenInEditor:v,mode:r,syntaxTheme:i,cursor:a&&a.chunkIndex===l?a:null,fileIndex:o,onLineClick:_,commentTrigger:y&&y.chunkIndex===l?y:null,onCommentTriggerHandled:b,filename:e.path})}),S&&x(`bottom`,c,C,w)]},l)})})}var Mv=e=>!!(e&&e!==`stdin`),Nv=[`text-[26px] font-semibold`,`text-[22px] font-semibold`,`text-xl font-semibold`,`text-lg font-semibold`,`text-base font-semibold uppercase tracking-wide`,`text-base font-semibold`],Pv=e=>e.type===`delete`||e.type===`remove`,Fv=e=>e.type===`normal`||e.type===`context`,Iv=e=>/^(https?:|mailto:|#|\.{0,2}\/|\/)/i.test(e.trim()),Lv=(e,t,n)=>{let r=e[e.length-1];if(r&&r.type===t){r.lines.push(n);return}e.push({type:t,lines:[n]})},Rv=(e,t)=>{t.forEach(t=>Lv(e,`delete`,t)),t.length=0},zv=e=>{let t=[],n=[],r=!1;return e.forEach(e=>{e.lines.forEach(e=>{if(!(e.type===`header`||e.type===`hunk`)){if(Pv(e)){n.push(e.content);return}if(e.type===`add`){n.length>0&&(Rv(t,n),r=!0),Lv(t,r?`change`:`add`,e.content);return}Fv(e)&&(Rv(t,n),r=!1,Lv(t,`context`,e.content))}}),Rv(t,n),r=!1}),t},Bv=e=>A.isValidElement(e),Vv=e=>A.isValidElement(e),Hv=e=>e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Hv).join(``):Bv(e)?Hv(e.props.children):``,Uv=e=>({h1:({children:e})=>(0,j.jsx)(`h1`,{className:`${Nv[0]} mt-6 mb-2 first:mt-0`,children:e}),h2:({children:e})=>(0,j.jsx)(`h2`,{className:`${Nv[1]} mt-6 mb-2 first:mt-0`,children:e}),h3:({children:e})=>(0,j.jsx)(`h3`,{className:`${Nv[2]} mt-6 mb-2 first:mt-0`,children:e}),h4:({children:e})=>(0,j.jsx)(`h4`,{className:`${Nv[3]} mt-6 mb-2 first:mt-0`,children:e}),h5:({children:e})=>(0,j.jsx)(`h5`,{className:`${Nv[4]} mt-6 mb-2 first:mt-0`,children:e}),h6:({children:e})=>(0,j.jsx)(`h6`,{className:`${Nv[5]} mt-6 mb-2 first:mt-0`,children:e}),p:({children:e})=>(0,j.jsx)(`p`,{className:`text-base leading-7`,children:e}),ul:({children:e})=>(0,j.jsx)(`ul`,{className:`list-disc pl-6 text-base space-y-1`,children:e}),ol:({children:e})=>(0,j.jsx)(`ol`,{className:`list-decimal pl-6 text-base space-y-1`,children:e}),li:({children:e})=>(0,j.jsx)(`li`,{children:e}),blockquote:({children:e})=>(0,j.jsx)(`blockquote`,{className:`border-l-4 border-github-border pl-4 text-github-text-muted italic`,children:e}),hr:()=>(0,j.jsx)(`hr`,{className:`border-github-border`}),a:({href:e,children:t})=>{let n=e??``;if(!n||!Iv(n))return(0,j.jsx)(`span`,{children:t});let r=n.startsWith(`http`);return(0,j.jsx)(`a`,{href:n,target:r?`_blank`:void 0,rel:r?`noreferrer`:void 0,className:`text-sky-400 hover:text-sky-300 underline underline-offset-4`,children:t})},img:({src:e,alt:t})=>{let n=e??``;return!n||!Iv(n)?null:(0,j.jsx)(`img`,{src:n,alt:t??``,loading:`lazy`,className:`max-w-full rounded border border-github-border`})},pre:({children:t})=>{let n=(Array.isArray(t)?t:[t]).find(Vv),r=Hv(n??t),i=/language-(\S+)/.exec(n?.props.className??``)?.[1],a=r.replace(/\n$/,``);return i===`mermaid`&&a.trim()?(0,j.jsx)(q_,{chart:a}):r.trim()?(0,j.jsx)(`pre`,{className:`markdown-preview-code border border-github-border bg-github-bg-secondary p-3 overflow-x-auto text-sm`,children:(0,j.jsx)(Yn,{code:a,language:i,syntaxTheme:e,className:`font-mono text-github-text-primary`})}):(0,j.jsx)(`pre`,{className:`markdown-preview-code border border-github-border bg-github-bg-secondary p-3 overflow-x-auto text-sm`,children:t})},code:({className:e,children:t})=>e?(0,j.jsx)(`code`,{className:e,children:t}):(0,j.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-github-bg-tertiary border border-github-border text-sm font-mono`,children:t}),table:({children:e})=>(0,j.jsx)(`div`,{className:`overflow-x-auto`,children:(0,j.jsx)(`table`,{className:`w-full border-collapse text-sm`,children:e})}),thead:({children:e})=>(0,j.jsx)(`thead`,{className:`bg-github-bg-secondary`,children:e}),tbody:({children:e})=>(0,j.jsx)(`tbody`,{children:e}),tr:({children:e})=>(0,j.jsx)(`tr`,{className:`border-b border-github-border`,children:e}),th:({children:e})=>(0,j.jsx)(`th`,{className:`px-3 py-2 text-left font-semibold border border-github-border`,children:e}),td:({children:e})=>(0,j.jsx)(`td`,{className:`px-3 py-2 border border-github-border`,children:e})}),Wv=e=>{switch(e){case`add`:return`border-l-4 border-diff-addition-border`;case`delete`:return`border-l-4 border-diff-deletion-border`;case`change`:return`border-l-4 border-diff-addition-border`;default:return`border-l-4 border-transparent`}},Gv=e=>/^\s*\[[^\]]+\]:\s+\S+/.test(e),Kv=e=>/^\s*\[\^[^\]]+\]:\s+/.test(e),qv=e=>{let t=e.trim();return t.length>=7&&t.startsWith(`<!--`)&&t.endsWith(`-->`)},Jv=e=>e.trim()===``||Gv(e)||Kv(e)||qv(e),Yv=e=>e.every(Jv),Xv=e=>{let t=e.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if(!t)return null;let n=t[1];return n?{marker:n[0],length:n.length,raw:e}:null},Zv=(e,t)=>{let n=e.match(/^\s{0,3}(`{3,}|~{3,})\s*$/);return n?.[1]?n[1][0]===t.marker&&n[1].length>=t.length:!1},Qv=e=>{let t=[],n=null,r=null,i=()=>{n&&=(t.push(n),null)},a=(e,t)=>{if(n?.type===e){n.lines.push(t);return}i(),n={kind:`markdown`,type:e,lines:[t]}},o=e=>{if(!r)return;let n=r.lines.every(e=>e.type===`context`);e&&n?(a(`context`,r.fence.raw),r.lines.forEach(e=>{a(`context`,e.content)}),a(`context`,e)):(i(),t.push({kind:`fenced-code`,lines:r.lines})),r=null};return e.forEach(e=>{e.lines.forEach(t=>{if(r){if(Zv(t,r.fence)){o(t);return}r.lines.push({type:e.type,content:t});return}let n=Xv(t);if(n){i(),r={fence:n,lines:[]};return}a(e.type,t)})}),o(),i(),t},$v=e=>{switch(e){case`add`:case`change`:return`border-l-4 border-diff-addition-border bg-diff-addition-bg`;case`delete`:return`border-l-4 border-diff-deletion-border bg-diff-deletion-bg`;default:return`border-l-4 border-transparent`}},ey=({blocks:e,syntaxTheme:t})=>{let n=(0,A.useMemo)(()=>Uv(t),[t]);return(0,j.jsx)(`div`,{className:`space-y-4`,children:(0,A.useMemo)(()=>Qv(e),[e]).map((e,t)=>{if(e.kind===`fenced-code`)return(0,j.jsx)(`div`,{className:`px-4`,children:(0,j.jsx)(`div`,{className:`markdown-preview-code overflow-x-auto rounded border border-github-border bg-github-bg-secondary text-sm font-mono text-github-text-primary`,children:e.lines.map((e,n)=>(0,j.jsx)(`div`,{className:`${$v(e.type)} whitespace-pre px-3 py-1`,children:e.content||` `},`preview-code-line-${t}-${n}`))})},`preview-block-${t}`);let r=e.lines.join(`
59
- `).trim();if(!r)return null;let i=Yv(e.lines);return(0,j.jsx)(`div`,{className:`px-4 ${Wv(e.type)}`,children:i?(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm text-github-text-primary font-mono`,children:r}):(0,j.jsx)(zm,{remarkPlugins:[U_],urlTransform:e=>Iv(e)?e:``,components:n,children:r})},`preview-block-${t}`)})})},ty=({content:e,syntaxTheme:t})=>{let n=(0,A.useMemo)(()=>Uv(t),[t]);return(0,j.jsx)(`div`,{className:`space-y-4`,children:(0,j.jsx)(zm,{remarkPlugins:[U_],urlTransform:e=>Iv(e)?e:``,components:n,children:e})})};function ny(e){let{file:t,baseCommitish:n,targetCommitish:r,mergedChunks:i,syntaxTheme:a}=e,[o,s]=(0,A.useState)(`diff`),[c,l]=(0,A.useState)(null),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(null),[m,h]=(0,A.useState)(null),g=(0,A.useMemo)(()=>zv(i),[i]),_=(0,A.useMemo)(()=>!n&&!r?null:t.status===`added`?r?{path:t.path,ref:r}:null:t.status===`deleted`?n?{path:t.oldPath||t.path,ref:n}:null:r?{path:t.path,ref:r}:n?{path:t.oldPath||t.path,ref:n}:null,[n,r,t.path,t.oldPath,t.status]),v=(0,A.useMemo)(()=>_?`${_.ref}:${_.path}`:null,[_]);(0,A.useEffect)(()=>{if(!_||!v||!Mv(_.ref)){l(null),h(null),p(null),d(!1);return}let e=!1;return(v!==m||c===null)&&(async()=>{v!==m&&l(null),d(!0),p(null);try{let t=encodeURIComponent(_.path),n=await fetch(`/api/blob/${t}?ref=${encodeURIComponent(_.ref)}`);if(!n.ok)throw Error(`Failed to fetch preview: ${n.statusText}`);let r=await n.text();e||(l(r),h(v))}catch(t){e||(l(null),h(null),p(t instanceof Error?t.message:`Failed to load preview`))}finally{e||d(!1)}})(),()=>{e=!0}},[c,m,_,v]);let y=(0,A.useMemo)(()=>v===m&&c!==null,[c,m,v]);return(0,A.useEffect)(()=>{o===`full-preview`&&!y&&s(`diff-preview`)},[y,o]),(0,j.jsxs)(`div`,{className:`bg-github-bg-primary`,children:[(0,j.jsx)(`div`,{className:`flex items-center justify-between border-b border-github-border px-4 py-2`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,j.jsxs)(`button`,{onClick:()=>s(`diff`),className:`px-2 py-1 text-xs font-medium rounded transition-colors duration-200 flex items-center gap-1 cursor-pointer ${o===`diff`?`text-github-text-primary`:`text-github-text-secondary hover:text-github-text-primary`}`,title:`Code Diff`,children:[(0,j.jsx)(Ge,{size:14}),`Diff`]}),(0,j.jsxs)(`button`,{onClick:()=>s(`diff-preview`),className:`px-2 py-1 text-xs font-medium rounded transition-colors duration-200 flex items-center gap-1 cursor-pointer ${o===`diff-preview`?`text-github-text-primary`:`text-github-text-secondary hover:text-github-text-primary`}`,title:`Diff Preview`,children:[(0,j.jsx)(We,{size:14}),`Diff Preview`]}),y&&(0,j.jsxs)(`button`,{onClick:()=>s(`full-preview`),className:`px-2 py-1 text-xs font-medium rounded transition-colors duration-200 flex items-center gap-1 cursor-pointer ${o===`full-preview`?`text-github-text-primary`:`text-github-text-secondary hover:text-github-text-primary`}`,title:`Full Preview`,children:[(0,j.jsx)(We,{size:14}),`Full Preview`]})]})}),o===`diff`&&(0,j.jsx)(jv,{...e}),o===`diff-preview`&&(0,j.jsx)(`div`,{className:`p-4`,children:(0,j.jsx)(ey,{blocks:g,syntaxTheme:a})}),o===`full-preview`&&(0,j.jsxs)(`div`,{className:`p-4`,children:[u&&(0,j.jsx)(`div`,{className:`text-sm text-github-text-muted mb-3`,children:`Loading preview...`}),f&&(0,j.jsx)(`div`,{className:`text-sm text-github-danger mb-3`,children:f}),!u&&!f&&c!==null&&(0,j.jsx)(ty,{content:c,syntaxTheme:a}),!u&&!f&&c===null&&(0,j.jsx)(`div`,{className:`text-sm text-github-text-muted`,children:`Preview unavailable.`})]})]})}var ry=[`text-2xl font-semibold`,`text-xl font-semibold`,`text-lg font-semibold`,`text-base font-semibold`,`text-sm font-semibold uppercase tracking-wide`,`text-sm font-semibold`],iy={markdown:`Markdown`,code:`Code`,raw:`Raw`,unknown:`Cell`},ay=/"cell_type"\s*:\s*"([^"]+)"/,oy=/"source"\s*:/,sy=/"execution_count"\s*:\s*(null|[0-9]+)/,cy=/"id"\s*:\s*"([^"]+)"/,ly=e=>e.type===`delete`||e.type===`remove`,uy=e=>e.type===`normal`||e.type===`context`,dy=e=>e.type===`add`?`add`:ly(e)?`delete`:uy(e)?`context`:null,fy=e=>e===`markdown`||e===`code`||e===`raw`?e:`unknown`,py=e=>{let t=e.trim();if(!t.startsWith(`"`))return null;let n=t;n.endsWith(`,`)&&(n=n.slice(0,-1));try{let e=JSON.parse(n);return typeof e==`string`?e:null}catch{return n.replace(/^"/,``).replace(/"$/,``).replace(/\\n/g,`
60
- `).replace(/\\t/g,` `).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}},my=e=>{let t=e.indexOf(`"source"`);if(t===-1)return null;let n=e.indexOf(`:`,t);if(n===-1)return null;let r=e.slice(n+1).trim();if(!r)return null;if(r.endsWith(`,`)&&(r=r.slice(0,-1).trim()),r.startsWith(`[`)){let e=r.lastIndexOf(`]`);if(e===-1)return null;let t=r.slice(0,e+1);try{let e=JSON.parse(t);if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}catch{return null}return[]}if(r.startsWith(`"`))try{let e=JSON.parse(r);return typeof e==`string`?[e]:null}catch{return null}return null},hy=e=>{let t=gy(e);if(t)return t;let n=[],r=null,i=!1,a=!1,o=!1,s=()=>{r&&(r.status=i&&a?`change`:i?`add`:a?`delete`:`context`,n.push(r),r=null,i=!1,a=!1,o=!1)},c=e=>{s(),r={cellType:e,sourceLines:[],status:`context`}};return e.forEach(e=>{e.lines.forEach(e=>{let t=dy(e);if(!t)return;let n=e.content.match(ay);if(n?c(fy(n[1]??``)):!r&&oy.test(e.content)&&c(`unknown`),!r)return;if(t===`add`&&(i=!0),t===`delete`&&(a=!0),!r.id){let t=e.content.match(cy);t&&(r.id=t[1])}if(r.executionCount===void 0){let t=e.content.match(sy);t&&(r.executionCount=t[1]===`null`?null:t[1])}if(oy.test(e.content)){let n=my(e.content);if(n){n.forEach(e=>{r?.sourceLines.push({type:t,content:e})}),o=!1;return}o=!0;return}if(!o)return;if(e.content.trim().startsWith(`]`)){o=!1;return}let s=py(e.content);s!==null&&r.sourceLines.push({type:t,content:s})})}),s(),{cells:n}},gy=e=>{let t=_y(e,[`add`,`context`]),n=_y(e,[`delete`,`context`]),r=vy(t),i=vy(n);if(!r&&!i||r&&r.cells.length===0&&!i)return null;let a=r?.language??i?.language;return{cells:Sy(i?.cells??[],r?.cells??[]),language:a}},_y=(e,t)=>e.flatMap(e=>e.lines).map(e=>{let n=dy(e);return!n||!t.includes(n)?null:e.content}).filter(e=>e!==null).join(`
61
- `),vy=e=>{if(!e.trim())return null;try{let t=JSON.parse(e);if(!t||typeof t!=`object`||!(`cells`in t))return null;let n=t.cells;if(!Array.isArray(n))return null;let r=t.metadata,i=yy(r);return{cells:n.map(e=>by(e)),language:i}}catch{return null}},yy=e=>{if(!e||typeof e!=`object`)return;let t=e,n=t.language_info;if(n&&typeof n==`object`){let e=n.name;if(typeof e==`string`&&e.trim())return e}let r=t.kernelspec;if(r&&typeof r==`object`){let e=r.language;if(typeof e==`string`&&e.trim())return e}},by=e=>{let t=typeof e==`object`&&e?e:{},n=fy(typeof t.cell_type==`string`?t.cell_type:``),r=typeof t.id==`string`?t.id:void 0,i=t.execution_count,a=i===null?null:typeof i==`number`?String(i):typeof i==`string`?i:void 0;return{cellType:n,sourceText:xy(t.source),id:r,executionCount:a}},xy=e=>typeof e==`string`?e:Array.isArray(e)?e.filter(e=>typeof e==`string`).join(``):``,Sy=(e,t)=>{let n=[];if(e.some(e=>!!e.id)||t.some(e=>!!e.id)){let r=new Map;e.forEach((e,t)=>{e.id&&r.set(e.id,{cell:e,index:t})});let i=new Set;return t.forEach(e=>{let t=e.id?r.get(e.id):void 0;t&&i.add(t.index),n.push(Cy(t?.cell??null,e))}),e.forEach((e,t)=>{i.has(t)||n.push(Cy(e,null))}),n}let r=Math.max(e.length,t.length);for(let i=0;i<r;i+=1){let r=e[i]??null,a=t[i]??null;n.push(Cy(r,a))}return n},Cy=(e,t)=>{if(!t&&e)return{cellType:e.cellType,sourceLines:wy(e.sourceText,`delete`),status:`delete`,id:e.id,executionCount:e.executionCount};if(t&&!e)return{cellType:t.cellType,sourceLines:wy(t.sourceText,`add`),status:`add`,id:t.id,executionCount:t.executionCount};let n=e?.sourceText??``,r=t?.sourceText??``,i=t?.cellType??e?.cellType??`unknown`,a=t?.id??e?.id,o=t?.executionCount??e?.executionCount;return n===r&&(e?.cellType??``)===(t?.cellType??``)?{cellType:i,sourceLines:wy(r,`context`),status:`context`,id:a,executionCount:o}:{cellType:i,sourceLines:[...wy(n,`delete`),...wy(r,`add`)],status:`change`,id:a,executionCount:o}},wy=(e,t)=>e?[{type:t,content:e}]:[],Ty=e=>!!(e&&e!==`stdin`),Ey=async(e,t)=>{let n=await fetch(`/api/blob/${encodeURIComponent(e)}?ref=${encodeURIComponent(t)}`);return n.ok?n.text():null},Dy=(e,t)=>e.filter(e=>t.includes(e.type)).map(e=>e.content).join(``),Oy=e=>{if(!e)return[];let t=e.split(`
62
- `);return t.length>0&&t[t.length-1]===``&&t.pop(),t},ky=(e,t)=>!e&&!t?[]:e?t?hv(e,t).flatMap(e=>{let t=e.added?`add`:e.removed?`delete`:`context`;return Oy(e.value).map(e=>({type:t,content:e}))}):Oy(e).map(e=>({type:`delete`,content:e})):Oy(t).map(e=>({type:`add`,content:e})),Ay=e=>A.isValidElement(e),jy=e=>A.isValidElement(e),My=e=>e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(My).join(``):Ay(e)?My(e.props.children):``,Ny=e=>{switch(e){case`add`:return`border-l-4 border-diff-addition-border`;case`delete`:return`border-l-4 border-diff-deletion-border`;case`change`:return`border-l-4 border-diff-addition-border`;default:return`border-l-4 border-transparent`}},Py=e=>{switch(e){case`before`:return`border-l-4 border-diff-deletion-border`;case`after`:return`border-l-4 border-diff-addition-border`;default:return`border-l-4 border-transparent`}},Fy=e=>{switch(e){case`add`:return`bg-diff-addition-bg`;case`delete`:return`bg-diff-deletion-bg`;default:return`bg-transparent`}},Iy=e=>{switch(e){case`add`:return`+`;case`delete`:return`-`;default:return` `}},Ly=e=>{switch(e){case`add`:return`text-github-accent`;case`delete`:return`text-github-danger`;default:return`text-github-text-muted`}},Ry=e=>/^(https?:|mailto:|#|\.{0,2}\/|\/)/i.test(e.trim()),zy=e=>({h1:({children:e})=>(0,j.jsx)(`h1`,{className:`${ry[0]} mb-2`,children:e}),h2:({children:e})=>(0,j.jsx)(`h2`,{className:`${ry[1]} mb-2`,children:e}),h3:({children:e})=>(0,j.jsx)(`h3`,{className:`${ry[2]} mb-2`,children:e}),h4:({children:e})=>(0,j.jsx)(`h4`,{className:`${ry[3]} mb-2`,children:e}),h5:({children:e})=>(0,j.jsx)(`h5`,{className:`${ry[4]} mb-2`,children:e}),h6:({children:e})=>(0,j.jsx)(`h6`,{className:`${ry[5]} mb-2`,children:e}),p:({children:e})=>(0,j.jsx)(`p`,{className:`text-sm leading-7`,children:e}),ul:({children:e})=>(0,j.jsx)(`ul`,{className:`list-disc pl-6 text-sm space-y-1`,children:e}),ol:({children:e})=>(0,j.jsx)(`ol`,{className:`list-decimal pl-6 text-sm space-y-1`,children:e}),li:({children:e})=>(0,j.jsx)(`li`,{children:e}),blockquote:({children:e})=>(0,j.jsx)(`blockquote`,{className:`border-l-4 border-github-border pl-4 text-github-text-muted italic`,children:e}),hr:()=>(0,j.jsx)(`hr`,{className:`border-github-border`}),a:({href:e,children:t})=>{let n=e??``;if(!n||!Ry(n))return(0,j.jsx)(`span`,{children:t});let r=n.startsWith(`http`);return(0,j.jsx)(`a`,{href:n,target:r?`_blank`:void 0,rel:r?`noreferrer`:void 0,className:`text-sky-400 hover:text-sky-300 underline underline-offset-4`,children:t})},img:({src:e,alt:t})=>{let n=e??``;return!n||!Ry(n)?null:(0,j.jsx)(`img`,{src:n,alt:t??``,loading:`lazy`,className:`max-w-full rounded border border-github-border`})},pre:({children:t})=>{let n=(Array.isArray(t)?t:[t]).find(jy),r=My(n??t),i=/language-(\S+)/.exec(n?.props.className??``)?.[1];return r.trim()?(0,j.jsx)(`pre`,{className:`border border-github-border bg-github-bg-secondary p-3 overflow-x-auto text-xs`,children:(0,j.jsx)(Yn,{code:r.replace(/\n$/,``),language:i,syntaxTheme:e,className:`font-mono text-github-text-primary [&_.token-line]:block [&_.token-line]:whitespace-pre`})}):(0,j.jsx)(`pre`,{className:`border border-github-border bg-github-bg-secondary p-3 overflow-x-auto text-xs`,children:t})},code:({className:e,children:t})=>e?(0,j.jsx)(`code`,{className:e,children:t}):(0,j.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-github-bg-tertiary border border-github-border text-xs font-mono`,children:t}),table:({children:e})=>(0,j.jsx)(`div`,{className:`overflow-x-auto`,children:(0,j.jsx)(`table`,{className:`min-w-full border border-github-border`,children:e})}),th:({children:e})=>(0,j.jsx)(`th`,{className:`border border-github-border px-2 py-1 bg-github-bg-tertiary text-sm`,children:e}),td:({children:e})=>(0,j.jsx)(`td`,{className:`border border-github-border px-2 py-1 text-sm`,children:e})}),By=e=>{let t=Dy(e.sourceLines,[`context`,`delete`]),n=Dy(e.sourceLines,[`context`,`add`]),r=[];return e.status===`change`?(t.trim()&&r.push({label:`Before`,content:t,tone:`before`}),n.trim()&&r.push({label:`After`,content:n,tone:`after`}),r.length===0&&r.push({label:`After`,content:n,tone:`after`}),r):e.status===`delete`?(r.push({label:`Before`,content:t||n,tone:`before`}),r):(r.push({label:`After`,content:n||t,tone:`after`}),r)},Vy=(e,t,n,r)=>{if(!t.trim())return(0,j.jsx)(`span`,{className:`text-xs text-github-text-muted`,children:`Empty cell`});if(e===`markdown`){let e=zy(n);return(0,j.jsx)(zm,{remarkPlugins:[U_],urlTransform:e=>Ry(e)?e:``,components:e,children:t})}return e===`raw`?(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap break-words text-xs font-mono text-github-text-primary`,children:t}):(0,j.jsx)(`pre`,{className:`overflow-x-auto text-xs`,children:(0,j.jsx)(Xn,{code:t.replace(/\n$/,``),language:r||`python`,syntaxTheme:n,className:`font-mono text-github-text-primary [&_.token-line]:block [&_.token-line]:whitespace-pre`})})},Hy=({lines:e,syntaxTheme:t,language:n})=>e.length===0?(0,j.jsx)(`span`,{className:`text-xs text-github-text-muted`,children:`Empty cell`}):(0,j.jsx)(`div`,{className:`overflow-x-auto`,children:(0,j.jsx)(`div`,{className:`font-mono text-xs`,children:e.map((e,r)=>(0,j.jsxs)(`div`,{className:`flex items-start min-h-[16px] ${Fy(e.type)}`,children:[(0,j.jsx)(`span`,{className:`w-5 text-center flex-shrink-0 select-none ${Ly(e.type)}`,children:Iy(e.type)}),(0,j.jsx)(Xn,{code:e.content||` `,language:n||`python`,syntaxTheme:t,className:`flex-1 px-3 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text [&_pre]:m-0 [&_pre]:p-0 [&_pre]:!bg-transparent [&_pre]:font-inherit [&_pre]:text-inherit [&_pre]:leading-inherit [&_code]:!bg-transparent [&_code]:font-inherit [&_code]:text-inherit [&_code]:leading-inherit`})]},`notebook-code-line-${r}`))})}),Uy=({cells:e,syntaxTheme:t,language:n})=>(0,j.jsx)(`div`,{className:`space-y-4`,children:e.map((e,r)=>{let i=By(e),a=e.cellType===`code`&&e.executionCount!==void 0?`In[${e.executionCount??` `}]`:null,o=e.cellType===`code`,s=o?ky(Dy(e.sourceLines,[`context`,`delete`]),Dy(e.sourceLines,[`context`,`add`])).filter(e=>e.type!==`context`):[];return o&&s.length===0?null:(0,j.jsxs)(`div`,{className:`rounded border border-github-border bg-github-bg-secondary/40 p-4 ${Ny(e.status)}`,children:[(0,j.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 mb-3`,children:(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-github-text-muted`,children:iy[e.cellType]}),a&&(0,j.jsx)(`span`,{className:`text-xs font-mono text-github-text-secondary`,children:a}),e.id&&(0,j.jsx)(`span`,{className:`text-xs font-mono text-github-text-muted`,children:e.id})]})}),(0,j.jsx)(`div`,{className:`space-y-3`,children:o?(0,j.jsx)(`div`,{className:`px-4 py-3 ${Py(e.status===`delete`?`before`:`after`)}`,children:(0,j.jsx)(Hy,{lines:s,syntaxTheme:t,language:n})}):i.map((i,a)=>(0,j.jsx)(`div`,{className:`px-4 py-3 ${Py(i.tone)}`,children:(0,j.jsx)(`div`,{className:`text-sm text-github-text-primary`,children:Vy(e.cellType,i.content,t,n)})},`notebook-cell-${r}-section-${a}`))})]},`notebook-cell-${r}`)})}),Wy=({cells:e,syntaxTheme:t,language:n})=>(0,j.jsx)(`div`,{className:`space-y-4`,children:e.map((e,r)=>{let i=e.cellType===`code`&&e.executionCount!==void 0?`In[${e.executionCount??` `}]`:null;return(0,j.jsxs)(`div`,{className:`rounded border border-github-border bg-github-bg-secondary/40 p-4`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-3`,children:[(0,j.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-github-text-muted`,children:iy[e.cellType]}),i&&(0,j.jsx)(`span`,{className:`text-xs font-mono text-github-text-secondary`,children:i}),e.id&&(0,j.jsx)(`span`,{className:`text-xs font-mono text-github-text-muted`,children:e.id})]}),(0,j.jsx)(`div`,{className:`text-sm text-github-text-primary`,children:Vy(e.cellType,e.sourceText,t,n)})]},`notebook-full-cell-${r}`)})});function Gy(e){let{file:t,baseCommitish:n,targetCommitish:r}=e,[i,a]=(0,A.useState)(`diff`),o=(0,A.useMemo)(()=>hy(e.mergedChunks),[e.mergedChunks]),[s,c]=(0,A.useState)({status:`idle`,cells:o.cells,language:o.language}),l=(0,A.useMemo)(()=>s.cells.filter(e=>e.status===`context`?!1:e.cellType===`code`?ky(Dy(e.sourceLines,[`context`,`delete`]),Dy(e.sourceLines,[`context`,`add`])).filter(e=>e.type!==`context`).length>0:!0),[s.cells]),[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(o.language),[m,h]=(0,A.useState)(!1),[g,_]=(0,A.useState)(null),[v,y]=(0,A.useState)(null),b=(0,A.useMemo)(()=>!n&&!r?null:t.status===`added`?r?{path:t.path,ref:r}:null:t.status===`deleted`?n?{path:t.oldPath||t.path,ref:n}:null:r?{path:t.path,ref:r}:n?{path:t.oldPath||t.path,ref:n}:null,[n,r,t.oldPath,t.path,t.status]),x=(0,A.useMemo)(()=>b?`${b.ref}:${b.path}`:null,[b]);return(0,A.useEffect)(()=>{let e=!1;return(async()=>{let i=n||`HEAD~1`,a=r||`HEAD`,s=t.oldPath||t.path,l=t.status!==`added`&&Ty(i),u=t.status!==`deleted`&&Ty(a);if(!l&&!u){c({status:`ready`,cells:o.cells,language:o.language,source:`diff`,message:`Notebook content could not be loaded, falling back to diff preview.`});return}c(e=>({...e,status:`loading`}));try{let[n,r]=await Promise.all([l?Ey(s,i):Promise.resolve(null),u?Ey(t.path,a):Promise.resolve(null)]),d=n?vy(n):null,f=r?vy(r):null;if(!d&&!f){e||c({status:`ready`,cells:o.cells,language:o.language,source:`diff`,message:`Notebook content could not be parsed, falling back to diff preview.`});return}let p=f?.language??d?.language??o.language,m=Sy(d?.cells??[],f?.cells??[]);e||c({status:`ready`,cells:m,source:`blob`,language:p})}catch(t){e||c({status:`error`,cells:o.cells,language:o.language,source:`diff`,message:t instanceof Error?t.message:`Failed to load notebook preview.`})}})(),()=>{e=!0}},[n,t.oldPath,t.path,t.status,e.mergedChunks,r,o]),(0,A.useEffect)(()=>{if(i!==`full-preview`)return;if(!b||!x||!Ty(b.ref)){d(null),y(null),_(null),h(!1);return}let e=!1;return(x!==v||!u)&&(async()=>{x!==v&&d(null),h(!0),_(null);try{let t=await Ey(b.path,b.ref);if(!t)throw Error(`Failed to load preview.`);let n=vy(t);if(!n)throw Error(`Notebook content could not be parsed.`);e||(d(n.cells),p(n.language??o.language),y(x))}catch(t){e||(d(null),y(null),_(t instanceof Error?t.message:`Failed to load preview`))}finally{e||h(!1)}})(),()=>{e=!0}},[o.language,u,v,i,b,x]),(0,j.jsxs)(`div`,{className:`bg-github-bg-primary`,children:[(0,j.jsx)(`div`,{className:`flex items-center justify-between border-b border-github-border px-4 py-2`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,j.jsxs)(`button`,{onClick:()=>a(`diff`),className:`px-2 py-1 text-xs font-medium rounded transition-colors duration-200 flex items-center gap-1 cursor-pointer ${i===`diff`?`text-github-text-primary`:`text-github-text-secondary hover:text-github-text-primary`}`,title:`Code Diff`,children:[(0,j.jsx)(Ge,{size:14}),`Diff`]}),(0,j.jsxs)(`button`,{onClick:()=>a(`diff-preview`),className:`px-2 py-1 text-xs font-medium rounded transition-colors duration-200 flex items-center gap-1 cursor-pointer ${i===`diff-preview`?`text-github-text-primary`:`text-github-text-secondary hover:text-github-text-primary`}`,title:`Diff Preview`,children:[(0,j.jsx)(We,{size:14}),`Diff Preview`]}),(0,j.jsxs)(`button`,{onClick:()=>a(`full-preview`),className:`px-2 py-1 text-xs font-medium rounded transition-colors duration-200 flex items-center gap-1 cursor-pointer ${i===`full-preview`?`text-github-text-primary`:`text-github-text-secondary hover:text-github-text-primary`}`,title:`Full Preview`,children:[(0,j.jsx)(We,{size:14}),`Full Preview`]})]})}),i===`diff`&&(0,j.jsx)(jv,{...e}),i===`diff-preview`&&(0,j.jsxs)(`div`,{className:`p-4`,children:[s.status===`loading`&&(0,j.jsx)(`div`,{className:`text-xs text-github-text-muted mb-3`,children:`Loading notebook preview…`}),s.message&&(0,j.jsx)(`div`,{className:`text-xs text-github-text-muted mb-3`,children:s.message}),l.length===0?(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`text-xs text-github-text-muted mb-3`,children:`No changed notebook cells were found. Showing raw diff instead.`}),(0,j.jsx)(jv,{...e})]}):(0,j.jsx)(Uy,{cells:l,syntaxTheme:e.syntaxTheme,language:s.language})]}),i===`full-preview`&&(0,j.jsxs)(`div`,{className:`p-4`,children:[m&&(0,j.jsx)(`div`,{className:`text-sm text-github-text-muted mb-3`,children:`Loading preview...`}),g&&(0,j.jsx)(`div`,{className:`text-sm text-github-danger mb-3`,children:g}),!m&&!g&&u&&(0,j.jsx)(Wy,{cells:u,syntaxTheme:e.syntaxTheme,language:f??o.language}),!m&&!g&&!u&&(0,j.jsx)(`div`,{className:`text-sm text-github-text-muted`,children:`Preview unavailable.`})]})]})}var Ky=[{id:`image`,match:e=>ac(e.path),Component:uc,canExpandHiddenLines:()=>!1},{id:`markdown`,match:e=>sc(e.path),Component:ny,canExpandHiddenLines:e=>e.status!==`added`&&e.status!==`deleted`},{id:`notebook`,match:e=>lc(e.path),Component:Gy,canExpandHiddenLines:e=>e.status!==`added`&&e.status!==`deleted`},{id:`default`,match:()=>!0,Component:jv,canExpandHiddenLines:e=>e.status!==`added`&&e.status!==`deleted`}],qy=e=>{let t=Ky[Ky.length-1];if(!t)throw Error(`No diff viewers registered`);return Ky.find(t=>t.match(e))??t},Jy=e=>{switch(e){case`added`:return(0,j.jsx)(qe,{size:16,className:`text-github-accent`});case`deleted`:return(0,j.jsx)(Je,{size:16,className:`text-github-danger`});case`renamed`:return(0,j.jsx)(Ke,{size:16,className:`text-github-warning`});default:return(0,j.jsx)(Ge,{size:16,className:`text-github-text-secondary`})}},Yy=({file:e,isCollapsed:t,isReviewed:n,onToggleCollapsed:r,onToggleAllCollapsed:i,onToggleReviewed:a})=>{let[o,s]=(0,A.useState)(!1);return(0,j.jsxs)(`div`,{className:`bg-github-bg-secondary border-t-2 border-t-github-accent border-b border-github-border px-5 py-4 flex items-center justify-between flex-wrap gap-3 sticky top-0 z-10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,j.jsx)(`button`,{onClick:n=>{n.altKey?i(!t):r(e.path)},className:`text-github-text-muted hover:text-github-text-primary transition-colors cursor-pointer`,title:t?`Expand file (Alt+Click to expand all)`:`Collapse file (Alt+Click to collapse all)`,children:t?(0,j.jsx)(Ie,{size:16}):(0,j.jsx)(Pe,{size:16})}),Jy(e.status),(0,j.jsx)(`h2`,{className:`text-sm font-mono text-github-text-primary m-0 overflow-hidden text-ellipsis whitespace-nowrap`,children:e.path}),(0,j.jsx)(`button`,{className:`bg-transparent border-none cursor-pointer px-1.5 py-1 rounded text-sm transition-all hover:bg-github-bg-tertiary ${o?`text-github-accent`:`text-github-text-secondary hover:text-github-text-primary`}`,onClick:()=>{Ct(e.path).then(()=>{console.log(`File path copied to clipboard:`,e.path),s(!0),setTimeout(()=>s(!1),2e3)}).catch(e=>{console.error(`Failed to copy file path:`,e)})},title:`Copy file path`,children:o?(0,j.jsx)(Ne,{size:14}):(0,j.jsx)(Ve,{size:14})}),e.oldPath&&e.oldPath!==e.path&&(0,j.jsxs)(`span`,{className:`text-xs text-github-text-muted italic`,children:[`(renamed from `,e.oldPath,`)`]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,j.jsxs)(`span`,{className:`font-medium px-1 py-0.5 rounded text-github-accent bg-green-100/10`,children:[`+`,e.additions]}),(0,j.jsxs)(`span`,{className:`font-medium px-1 py-0.5 rounded text-github-danger bg-red-100/10`,children:[`-`,e.deletions]})]}),(0,j.jsxs)(`button`,{onClick:()=>a(e.path),className:`flex items-center gap-2 px-3 py-1.5 rounded-md text-sm font-medium transition-all duration-200 ${n?`bg-github-accent text-white`:`dark:bg-slate-600 dark:text-white dark:border-slate-500 dark:hover:bg-slate-500 dark:hover:border-slate-400 bg-github-bg-secondary text-github-text-primary border border-github-border hover:bg-github-bg-tertiary hover:border-github-text-muted`}`,title:n?`Mark as not reviewed`:`Mark as reviewed`,children:[n?(0,j.jsx)(Ne,{size:14}):(0,j.jsx)(lt,{size:14}),`Viewed`]})]})]})},Xy=e=>{let t={old:[],new:[]};return e.forEach(e=>{let n=e.side??`new`,[r,i]=Array.isArray(e.line)?[e.line[0],e.line[1]]:[e.line,e.line];r<=0||i<=0||t[n].push({start:Math.min(r,i),end:Math.max(r,i)})}),t},Zy=(e,t)=>e.chunks.map((e,n)=>{let r=t===`old`?e.oldStart:e.newStart,i=t===`old`?e.oldLines:e.newLines;return!r||i<=0?null:{start:r,end:r+i-1,index:n}}).filter(e=>!!e),Qy=e=>{let t=[],n=e[0];if(!n)return t;n.start>1&&t.push({type:`before`,start:1,end:n.start-1,nextChunkIndex:n.index});for(let n=1;n<e.length;n+=1){let r=e[n-1],i=e[n];!r||!i||i.start>r.end+1&&t.push({type:`between`,start:r.end+1,end:i.start-1,prevChunkIndex:r.index,nextChunkIndex:i.index})}let r=e[e.length-1];return r&&t.push({type:`after`,start:r.end+1,end:1/0,prevChunkIndex:r.index}),t},$y=e=>{let t=new Map;return e.forEach(e=>{let n=e.originalIndices[0];n!==void 0&&t.set(n,e)}),t},eb=e=>{let t=e[e.length-1];return t?.originalIndices[t.originalIndices.length-1]??null},tb=(0,A.memo)(function({file:e,threads:t,showAuthorBadges:n=!1,diffMode:r,reviewedFiles:i,onToggleReviewed:a,collapsedFiles:o,onToggleCollapsed:s,onToggleAllCollapsed:c,onAddComment:l,onGenerateThreadPrompt:u,onRemoveThread:d,onReplyToThread:f,onRemoveMessage:p,onUpdateMessage:m,onOpenInEditor:h,syntaxTheme:g,baseCommitish:_,targetCommitish:v,cursor:y=null,fileIndex:b=0,onLineClick:x,commentTrigger:S,onCommentTriggerHandled:C,mergedChunks:w,expandLines:T,expandAllBetweenChunks:E,prefetchFileContent:D,isExpandLoading:O}){let k=o.has(e.path),M=(0,A.useRef)(null),[N,P]=(0,A.useState)(!1),ee=qy(e),F=ee.canExpandHiddenLines?.(e)??!1;(0,A.useEffect)(()=>{if(!F)return;let e=M.current;if(!e)return;let t=new IntersectionObserver(([e])=>{e?.isIntersecting&&P(!0)},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[F]),(0,A.useEffect)(()=>{N&&!k&&F&&D(e)},[N,k,F,e,D]);let I=(0,A.useCallback)(async(t,n,r,i)=>{try{await l(e.path,t,n,r,i)}catch(e){console.error(`Failed to add comment:`,e)}},[e.path,l]);(0,A.useEffect)(()=>{if(k||O||!F||t.length===0||e.chunks.length===0||w.length===0)return;let n=Xy(t),r=$y(w),i=eb(w),a=w[w.length-1],o=new Set,s=(e,t)=>{o.has(e)||(o.add(e),t())};[`old`,`new`].forEach(t=>{let o=n[t];o.length!==0&&Qy(Zy(e,t)).forEach(t=>{if(!o.some(e=>e.start<=t.end&&e.end>=t.start))return;if(t.type===`after`&&a&&i!==null){a.hiddenLinesAfter>0&&s(`after-${i}`,()=>{T(e,i,`down`,a.hiddenLinesAfter)});return}let n=t.nextChunkIndex;if(n===void 0)return;let c=r.get(n);!c||c.hiddenLinesBefore<=0||(t.type===`before`?s(`before-${n}`,()=>{T(e,n,`up`,c.hiddenLinesBefore)}):t.type===`between`&&s(`between-${n}`,()=>{E(e,n,c.hiddenLinesBefore)}))})})},[t,E,T,e,k,O,w,F]);let te=ee.Component,ne={file:e,threads:t,showAuthorBadges:n,diffMode:r,syntaxTheme:g,baseCommitish:_,targetCommitish:v,cursor:y,fileIndex:b,mergedChunks:w,isExpandLoading:O,expandHiddenLines:T,expandAllBetweenChunks:E,onAddComment:I,onGenerateThreadPrompt:u,onRemoveThread:d,onReplyToThread:f,onRemoveMessage:p,onUpdateMessage:m,onOpenInEditor:h,onLineClick:x,commentTrigger:S,onCommentTriggerHandled:C};return(0,j.jsxs)(`div`,{ref:M,className:`bg-github-bg-primary`,style:{"--line-number-width":`4em`},children:[(0,j.jsx)(Yy,{file:e,isCollapsed:k,isReviewed:i.has(e.path),onToggleCollapsed:s,onToggleAllCollapsed:c,onToggleReviewed:a}),!k&&(0,j.jsx)(`div`,{className:`overflow-y-auto`,children:(0,j.jsx)(te,{...ne})})]})}),nb=16,rb=24;function ib(e){return`${e*rb+nb}px`}function ab(e){if(!e.isDirectory||!e.children)return[];let t=[];return e.path&&t.push(e.path),e.children.forEach(e=>{t.push(...ab(e))}),t}function ob(e,t){let n=new Set,r=e=>{if(e.file)return t.has(e.file.path);if(!e.isDirectory||!e.children||e.children.length===0)return!1;let i=e.children.map(e=>r(e)).every(Boolean);return i&&e.path&&n.add(e.path),i};return r(e),n}function sb(e){let t={name:``,path:``,isDirectory:!0,children:[]};e.forEach(e=>{let n=e.path.split(`/`),r=t;for(let t=0;t<n.length;t++){let i=n[t];if(!i)continue;let a=t===n.length-1,o=n.slice(0,t+1).join(`/`);r.children||=[];let s=r.children.find(e=>e.name===i);s||(s={name:i,path:o,isDirectory:!a,children:a?void 0:[],file:a?e:void 0},r.children.push(s)),r=s}});let n=e=>{if(!e.isDirectory||!e.children)return e;if(e.children=e.children.map(n),e.children.length===1&&e.children[0]?.isDirectory&&e.children[0]?.children){let t=e.children[0];if(t)return e.name?{...e,name:`${e.name}/${t.name}`,path:t.path,children:t.children}:e}return e};return n(t)}var cb=(0,A.memo)(function({files:e,onScrollToFile:t,onFileSelected:n,comments:r,reviewedFiles:i,onToggleReviewed:a,selectedFileIndex:o}){let s=(0,A.useMemo)(()=>sb(e),[e]),c=(0,A.useRef)(null),l=(0,A.useRef)(new Map),u={"--dir-row-height":`calc(var(--spacing, 0.25rem) * 9)`},[d,f]=(0,A.useState)(()=>new Set(ab(s))),[p,m]=(0,A.useState)(``),h=(0,A.useMemo)(()=>{let e=new Map;return r.forEach(t=>{e.set(t.file,(e.get(t.file)??0)+1)}),e},[r]),g=(0,A.useMemo)(()=>{let t=new Map;return e.forEach((e,n)=>{t.set(e.path,n)}),t},[e]),_=(0,A.useMemo)(()=>ob(s,i),[s,i]),v=(0,A.useMemo)(()=>{let e=p.trim().toLowerCase(),t=n=>{if(!e)return n;if(n.isDirectory&&n.children){let e=n.children.map(e=>t(e)).filter(e=>e!==null);return e.length>0?{...n,children:e}:null}else if(n.file)return n.file.path.toLowerCase().includes(e)?n:null;return null};return t(s)||{...s,children:[]}},[s,p]),y=e=>{switch(e){case`added`:return(0,j.jsx)(qe,{size:16,className:`text-github-accent`});case`deleted`:return(0,j.jsx)(Je,{size:16,className:`text-github-danger`});case`renamed`:return(0,j.jsx)(Ke,{size:16,className:`text-github-warning`});default:return(0,j.jsx)(Ge,{size:16,className:`text-github-text-secondary`})}},b=e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},x=(0,A.useMemo)(()=>ab(s),[s]),S=d.size===x.length&&x.length>0,C=()=>{f(S?new Set:new Set(x))},w=(e,t)=>{let n=c.current,r=e.currentTarget;if(!n){b(t);return}let i=n.getBoundingClientRect(),a=r.getBoundingClientRect(),o=Number.parseFloat(getComputedStyle(r).top||`0`);if(a.top-i.top<=o+1){let e=l.current.get(t)?.querySelector(`[data-tree-row="true"]:not([data-dir-header="true"])`),i=r.getBoundingClientRect().height||0,a=e??r,o=i*Number.parseInt(a.dataset.depth||r.dataset.depth||`0`,10),s=Math.max(0,a.offsetTop-o);if(Math.abs(n.scrollTop-s)<=1){b(t);return}n.scrollTo({top:s,behavior:`smooth`});return}b(t)},T=(e,r=0)=>{if(e.isDirectory&&e.children){let t=d.has(e.path),n=_.has(e.path);return(0,j.jsxs)(`div`,{"data-dir-container":e.path||void 0,ref:t=>{e.path&&(t?l.current.set(e.path,t):l.current.delete(e.path))},children:[e.name&&(0,j.jsxs)(`div`,{className:`sticky flex h-9 items-center gap-2 bg-github-bg-secondary px-4 hover:bg-github-bg-tertiary cursor-pointer ${n?`opacity-70`:``}`,"data-dir-header":`true`,"data-tree-row":`true`,"data-depth":r,style:{paddingLeft:ib(r),top:`calc(${r} * var(--dir-row-height))`,zIndex:1e3-r},onClick:t=>w(t,e.path),children:[t?(0,j.jsx)(Pe,{size:16}):(0,j.jsx)(Ie,{size:16}),t?(0,j.jsx)(Ye,{size:16,className:`text-github-text-secondary`}):(0,j.jsx)(Xe,{size:16,className:`text-github-text-secondary`}),(0,j.jsx)(`span`,{className:`text-sm text-github-text-primary font-medium flex-1 overflow-hidden text-ellipsis whitespace-nowrap ${n?`line-through text-github-text-muted`:``}`,title:e.name,children:e.name})]}),(t||!e.name)&&e.children.map(t=>T(t,e.name?r+1:r))]},e.path)}else if(e.file){let s=e.file,c=h.get(s.path)??0,l=i.has(s.path),u=g.get(s.path)??-1;return(0,j.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 hover:bg-github-bg-tertiary cursor-pointer transition-colors ${l?`opacity-70`:``} ${o!==null&&o===u?`bg-github-bg-tertiary`:``}`,"data-file-row":`true`,"data-tree-row":`true`,"data-depth":r,style:{paddingLeft:ib(r)},onClick:()=>{t(s.path),n?.()},children:[(0,j.jsx)(bt,{checked:l,onChange:()=>{a(s.path)},title:l?`Mark as not reviewed`:`Mark as reviewed`,className:`z-10`}),y(e.file.status),(0,j.jsx)(`span`,{className:`text-sm text-github-text-primary flex-1 overflow-hidden text-ellipsis whitespace-nowrap ${l?`line-through text-github-text-muted`:``}`,title:e.file.path,children:e.name}),c>0&&(0,j.jsxs)(`span`,{className:`text-github-warning text-sm font-medium ml-auto flex items-center gap-1`,children:[(0,j.jsx)(nt,{size:14}),c]})]},s.path)}return null};return(0,j.jsxs)(`div`,{className:`h-full flex flex-col`,children:[(0,j.jsxs)(`div`,{className:`px-4 py-3 border-b border-github-border bg-github-bg-tertiary`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,j.jsxs)(`h3`,{className:`text-sm font-semibold text-github-text-primary m-0`,children:[`Files changed (`,e.length,`)`]}),(0,j.jsx)(`button`,{onClick:C,className:`p-1 hover:bg-github-bg-primary rounded transition-colors`,title:S?`Collapse all`:`Expand all`,children:S?(0,j.jsx)(Le,{size:16,className:`text-github-text-secondary`}):(0,j.jsx)(Re,{size:16,className:`text-github-text-secondary`})})]}),(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(st,{size:16,className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-github-text-muted`}),(0,j.jsx)(`input`,{type:`text`,placeholder:`Filter files...`,value:p,onChange:e=>m(e.target.value),className:`w-full pl-9 pr-3 py-2 text-sm bg-github-bg-primary border border-github-border rounded-md focus:outline-none focus:border-github-accent text-github-text-primary placeholder-github-text-muted`})]})]}),(0,j.jsx)(`div`,{className:`flex-1 overflow-y-auto relative z-0`,style:u,ref:c,children:v.children?.map(e=>T(e))})]})});function lb({style:e}){return(0,j.jsx)(`svg`,{width:`98`,height:`96`,viewBox:`0, 0, 98, 96`,style:e,xmlns:`http://www.w3.org/2000/svg`,"aria-label":`GitHub`,role:`img`,children:(0,j.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z`,fill:`currentColor`})})}function ub({isOpen:e,onClose:t}){let{enableScope:n,disableScope:r}=ge();return xe(`escape`,()=>t(),{enabled:e},[t,e]),(0,A.useEffect)(()=>(e?r(`navigation`):n(`navigation`),()=>{n(`navigation`)}),[e,n,r]),e?(0,j.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0 bg-black/50`,onClick:t}),(0,j.jsxs)(`div`,{className:`relative bg-github-bg-primary border border-github-border rounded-lg shadow-lg max-w-4xl w-full mx-4 max-h-[80vh] overflow-y-auto`,children:[(0,j.jsxs)(`div`,{className:`sticky top-0 bg-github-bg-primary border-b border-github-border px-6 py-4 flex items-center justify-between`,children:[(0,j.jsx)(`h2`,{className:`text-lg font-semibold text-github-text-primary`,children:`Keyboard Shortcuts`}),(0,j.jsx)(`button`,{onClick:t,className:`text-github-text-secondary hover:text-github-text-primary transition-colors`,"aria-label":`Close help modal`,children:(0,j.jsx)(pt,{size:20})})]}),(0,j.jsxs)(`div`,{className:`px-6 py-4 grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Line Navigation`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`j`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`↓`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Next line`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`k`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`↑`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Previous line`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`File Navigation`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`]`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Next file`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`[`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Previous file`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`[`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Jump to first file`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`]`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Jump to last file`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Chunk Navigation`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`n`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Next change chunk (added/deleted lines)`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`p`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Previous change chunk (added/deleted lines)`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Comment Navigation`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`N`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Next comment`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`P`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Previous comment`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Side Navigation (Side-by-side mode)`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`h`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`←`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Focus left side`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`l`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`→`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Focus right side`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Comment Management`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`L`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`View all comments list`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`C`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Copy all comments prompt`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`D`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Delete all comments`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Actions`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`v`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Toggle viewed state of current file`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`R`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Refresh diff when changes detected`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`c`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Add comment at current line`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`.`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Move cursor to center of viewport`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`?`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Show/hide this help`})]})]})]}),(0,j.jsx)(`div`,{className:`pt-4 border-t border-github-border lg:col-span-2`,children:(0,j.jsx)(`p`,{className:`text-xs text-github-text-secondary`,children:`Shortcuts are disabled when typing in input fields.`})})]})]})]}):null}function db({style:e}){return(0,j.jsxs)(`svg`,{style:e,viewBox:`0 0 720 190`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-label":`difit`,role:`img`,children:[(0,j.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M440.487 5.90627C432.164 9.01695 427.318 16.2817 427.318 25.649C427.318 35.9474 433.206 43.6458 442.714 45.7819C451.336 47.7188 459.606 44.3893 464.84 36.8737C466.923 33.8843 467.35 32.4073 467.606 27.3105C467.773 23.9957 467.492 20.0154 466.983 18.4654C465.699 14.5629 460.869 9.13088 456.854 7.07513C452.57 4.88086 444.73 4.32102 440.487 5.90627ZM596.658 6.653C588.927 9.55794 584.572 15.4908 583.887 24.0465C583.17 33.0212 586.83 39.8868 594.382 43.7278C603.739 48.4877 615.574 44.5081 620.482 34.9515C625.35 25.4728 622.15 13.4916 613.37 8.32678C608.986 5.74808 601.154 4.96365 596.658 6.653ZM368.585 7.68006C367.464 8.80629 367.302 12.903 367.302 40.2286V71.4878L363.832 68.1329C353.432 58.0787 335.595 52.668 319.246 54.6082C310.542 55.641 299.81 59.1369 293.3 63.0607C278.56 71.9427 266.453 89.5576 263.139 106.945C261.765 114.155 261.602 129.431 262.825 136.365C265.723 152.796 274.795 168.36 286.716 177.355C298.275 186.077 310.237 190 325.274 190C340.687 190 353.943 185.273 362.869 176.594L367.302 172.284V178.215C367.302 186.902 366.946 186.724 384.303 186.709C392.243 186.702 399.29 186.347 399.964 185.919C401.04 185.236 401.189 174.47 401.189 97.1224C401.189 23.7236 401.003 8.87842 400.068 7.74809C398.433 5.77021 370.547 5.71037 368.585 7.68006ZM526.937 7.94153C519.783 10.0325 515.359 12.5834 510.029 17.6867C501.959 25.4129 498.766 34.4597 498.766 49.5975V58.8517H490.659C484.378 58.8517 482.263 59.1418 481.268 60.1394C480.214 61.1976 479.986 63.6558 479.986 73.91C479.986 82.5264 480.289 86.6977 480.966 87.3764C481.601 88.0141 484.903 88.36 490.356 88.36H498.766V136.692C498.766 183.638 498.811 185.048 500.345 185.873C502.433 186.994 529.394 186.994 531.482 185.873C533.016 185.048 533.061 183.638 533.061 136.692V88.36H549.334C563.038 88.36 565.809 88.1568 566.89 87.0723C568.782 85.1723 568.782 62.0394 566.89 60.1394C565.808 59.0541 563.029 58.8517 549.231 58.8517H532.856L533.216 51.9721C533.604 44.5499 534.721 41.9147 538.546 39.3958C540.377 38.1901 543.049 37.904 554.661 37.6737C562.626 37.5155 569.018 37.0343 569.602 36.5483C570.892 35.4761 571.046 10.3579 569.777 7.9776C568.978 6.47923 567.918 6.39562 550.384 6.45054C535.269 6.49808 530.93 6.77431 526.937 7.94153ZM654.931 26.4834C653.136 27.7662 653.094 28.1572 653.094 43.3245V58.8517H644.567C633.342 58.8517 633.497 58.6443 633.497 73.6059C633.497 88.5674 633.342 88.36 644.567 88.36H653.094V122.636C653.094 159.998 653.439 163.935 657.362 171.354C661.848 179.838 669.111 184.99 680.857 188.022C687.996 189.866 707.647 189.269 714.309 187.007C719.756 185.158 719.86 184.87 719.969 171.298C720.082 157.364 720.441 157.791 709.174 158.48C695.386 159.324 689.341 156.938 687.388 149.883C686.927 148.214 686.58 134.435 686.577 117.663L686.572 88.36H702.068H717.564L718.87 86.3592C719.946 84.7108 720.129 82.3461 719.91 72.9575C719.719 64.8279 719.321 61.1689 718.522 60.2041C717.553 59.0345 715.315 58.8517 701.987 58.8517H686.572L686.546 43.8926C686.526 31.8556 686.28 28.613 685.288 27.2941C684.156 25.7884 682.945 25.6351 670.412 25.4129C658.94 25.2088 656.476 25.3793 654.931 26.4834ZM431.459 60.1394C430.316 61.2877 430.178 68.0001 430.188 121.82C430.197 168.838 430.429 182.667 431.232 184.262L432.264 186.311L446.657 186.535C458.941 186.725 461.242 186.567 462.353 185.452C463.521 184.279 463.655 177.845 463.655 122.786C463.655 68.0985 463.515 61.2877 462.372 60.1394C460.469 58.2287 433.362 58.2287 431.459 60.1394ZM587.799 60.4369C587.238 61.4894 586.954 82.56 586.954 123.084C586.954 177.502 587.093 184.285 588.236 185.434C590.138 187.342 616.431 187.342 618.333 185.434C619.476 184.285 619.615 177.447 619.615 122.482C619.615 75.6149 619.38 60.5828 618.636 59.8353C617.947 59.1443 613.344 58.8517 603.15 58.8517C589.644 58.8517 588.586 58.9607 587.799 60.4369ZM347.956 87.3469C362.023 93.9543 369.138 107.306 367.775 124.535C366.623 139.097 359.678 149.866 347.83 155.463C337.073 160.544 325.541 160.523 315.049 155.403C293.381 144.83 288.765 112.315 306.417 94.5961C313.92 87.0641 322.021 84.1412 334.301 84.5354C341.49 84.7666 343.224 85.124 347.956 87.3469Z`,fill:`currentColor`}),(0,j.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9.42299 0.744751C4.61699 2.15275 2.03999 5.66375 0.956994 12.2768C-0.369006 20.3728 -0.294006 170.791 1.03899 176.572C2.29699 182.031 4.81699 185.308 9.65399 187.774C13.265 189.615 16.865 189.684 108.63 189.684C163.129 189.684 204.095 189.304 204.41 188.795C206 188.5 206 188.795 207.5 188C211.167 187.079 216.779 180.138 218.005 175.584C218.682 173.068 218.939 143.952 218.756 90.4718C218.487 11.7478 218.417 9.10275 216.535 6.62675C215.466 5.22075 213.441 3.19575 212.035 2.12675C209.546 0.23575 206.839 0.17975 110.978 0.0167504C55.373 -0.0782496 11.148 0.239751 9.42299 0.744751ZM203.778 14.8838C205.558 16.6638 205.509 172.577 203.728 175.005C202.577 176.574 198.865 176.688 156.978 176.446L111.478 176.184L111.226 138.684L110.974 101.184H84.059C69.255 101.184 56.808 101.52 56.397 101.931C55.986 102.343 60.674 107.82 66.814 114.104C72.954 120.388 77.978 126.202 77.978 127.026C77.978 129.577 74.769 134.267 71.896 135.916C69.609 137.229 68.75 137.278 66.704 136.217C63.533 134.572 28.705 99.1448 27.757 96.5998C27.36 95.5348 27.491 93.4308 28.049 91.9238C28.955 89.4768 68.498 49.6838 70.024 49.6838C70.366 49.6838 72.356 51.1627 74.447 52.9697C77.589 55.6867 78.118 56.6658 77.498 58.6198C77.086 59.9198 72.075 65.8308 66.363 71.7568C60.651 77.6818 55.978 83.0148 55.978 83.6068C55.978 84.3488 64.068 84.6838 81.952 84.6838H107.927H110.666C111.144 82.5 110.978 73.4537 110.978 46.2337V13.6838H156.778C191.067 13.6838 202.88 13.9858 203.778 14.8838ZM148.803 52.7217C146.51 54.0597 144.845 59.5997 145.74 62.9107C146.146 64.4107 150.657 69.9308 155.764 75.1788C161.411 80.9788 164.547 84.8988 163.764 85.1788C163.057 85.4318 151.549 85.7608 138.19 85.9108C117.896 86.1388 113.747 86.4308 112.956 87.6838C112.435 88.5088 112.002 91.7228 111.993 94.8268C111.982 99.0598 112.373 100.622 113.56 101.077C114.43 101.411 126.13 101.684 139.56 101.684C156.121 101.684 163.978 102.026 163.978 102.746C163.978 103.33 160.187 107.607 155.554 112.251C146.244 121.582 144.276 125.371 146.069 130.514C147.321 134.107 149.576 135.684 153.463 135.684C155.522 135.684 159.843 131.902 173.778 117.904C191.699 99.9008 194.978 96.0678 194.978 93.1208C194.978 91.1338 157.422 53.8238 154.163 52.5728C151.322 51.4818 150.908 51.4937 148.803 52.7217Z`,fill:`currentColor`})]})}function fb({shouldReload:e,isReloading:t,onReload:n,changeType:r,className:i=``,compact:a=!1}){return e?(0,j.jsxs)(`button`,{onClick:n,disabled:t,className:`
55
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function gv(e,t,n){return hv.diff(e,t,n)}function _v(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
56
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function vv(e){return e==`.`||e==`!`||e==`?`}new class extends Y_{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(vv(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends Y_{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Y_{constructor(){super(...arguments),this.tokenize=_v}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(yv(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function yv(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=yv(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=yv(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Y_{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function bv(e,t){let n=mv(e,t),r=[],i=[];for(let e of n)e.added?i.push({value:e.value,type:`added`}):e.removed?r.push({value:e.value,type:`removed`}):(r.push({value:e.value,type:`unchanged`}),i.push({value:e.value,type:`unchanged`}));return{oldSegments:r,newSegments:i}}function xv(e,t){if(!e.trim()||!t.trim()||e===t)return!1;let n=dv(e,t),r=0,i=0;for(let e of n)i+=e.value.length,!e.added&&!e.removed&&(r+=e.value.length);return r/i>=.2}var Sv=A.memo(({onMouseDown:e,onMouseUp:t,title:n=`Add a comment`})=>(0,j.jsx)(`button`,{className:`absolute -right-2 top-1/2 -translate-y-1/2 w-7 h-7 flex items-center justify-center rounded transition-all duration-150 hover:scale-110 z-10`,"data-comment-button":`true`,style:{backgroundColor:`var(--color-yellow-btn-bg)`,color:`var(--color-yellow-btn-text)`,border:`1px solid var(--color-yellow-btn-border)`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`var(--color-yellow-btn-hover-bg)`,e.currentTarget.style.borderColor=`var(--color-yellow-btn-hover-border)`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`var(--color-yellow-btn-bg)`,e.currentTarget.style.borderColor=`var(--color-yellow-btn-border)`},onMouseDown:e,onMouseUp:t,title:n,children:(0,j.jsx)(nt,{className:`w-4 h-4`})}));Sv.displayName=`CommentButton`;var Cv=A.memo(({onClick:e,title:t=`Open in editor`,className:n})=>(0,j.jsx)(`button`,{className:`absolute -right-10 top-1/2 -translate-y-1/2 w-7 h-7 flex items-center justify-center rounded transition-all duration-150 hover:scale-110 z-10 ${n||``}`,"data-open-in-editor-button":`true`,style:{backgroundColor:`var(--color-editor-btn-bg)`,color:`var(--color-editor-btn-text)`,border:`1px solid var(--color-editor-btn-border)`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`var(--color-editor-btn-hover-bg)`,e.currentTarget.style.borderColor=`var(--color-editor-btn-hover-border)`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`var(--color-editor-btn-bg)`,e.currentTarget.style.borderColor=`var(--color-editor-btn-border)`},onMouseDown:e=>{e.stopPropagation()},onClick:t=>{t.stopPropagation(),e(t)},title:t,children:(0,j.jsx)(Ue,{className:`w-4 h-4 opacity-80`})}));Cv.displayName=`OpenInEditorButton`;var wv=e=>{if(`isExpanded`in e&&e.isExpanded)return`bg-github-bg-tertiary/80`;switch(e.type){case`add`:return`bg-diff-addition-bg`;case`delete`:return`bg-diff-deletion-bg`;default:return`bg-transparent`}},Tv=A.memo(({line:e,index:t,lineId:n,isCurrentLine:r=!1,hoveredLineIndex:i,selectedLineStyle:a,onMouseEnter:o,onMouseLeave:s,onMouseMove:c,onCommentButtonMouseDown:l,onCommentButtonMouseUp:u,onOpenInEditor:d,syntaxTheme:f,onClick:p,filename:m,diffSegments:h})=>{let g=e.newLineNumber||e.oldLineNumber,_=i===t&&g,v=r?`keyboard-cursor`:``;return(0,j.jsxs)(`tr`,{id:n,className:`group ${wv(e)} relative ${a} ${v} cursor-pointer`,onMouseEnter:o,onMouseLeave:s,onMouseMove:c,onClick:p,children:[(0,j.jsx)(`td`,{className:`w-[var(--line-number-width)] min-w-[var(--line-number-width)] max-w-[var(--line-number-width)] px-2 text-right text-github-text-muted bg-github-bg-secondary border-r border-github-border select-none align-top relative`,children:e.oldLineNumber||``}),(0,j.jsxs)(`td`,{className:`w-[var(--line-number-width)] min-w-[var(--line-number-width)] max-w-[var(--line-number-width)] px-2 text-right text-github-text-muted bg-github-bg-secondary border-r border-github-border select-none align-top relative overflow-visible`,children:[(0,j.jsx)(`span`,{children:e.newLineNumber||``}),_&&(0,j.jsxs)(j.Fragment,{children:[d&&(0,j.jsx)(Cv,{onClick:d}),(0,j.jsx)(Sv,{onMouseDown:l,onMouseUp:u})]})]}),(0,j.jsx)(`td`,{className:`p-0 w-full relative align-top`,children:(0,j.jsx)(er,{line:e,syntaxTheme:f,filename:m,diffSegments:h})})]})});Tv.displayName=`DiffLineRow`;var Ev=e=>e!==void 0&&`isExpanded`in e&&e.isExpanded===!0,Dv=(e,t)=>t?`bg-github-bg-tertiary/80`:e?.type===`delete`?`bg-diff-deletion-bg`:e?.type===`add`?`bg-diff-addition-bg`:e?.type===`normal`?`bg-transparent`:`bg-github-bg-secondary`;function Ov({chunk:e,chunkIndex:t,threads:n,showAuthorBadges:r=!1,onAddComment:i,onGenerateThreadPrompt:a,onRemoveThread:o,onReplyToThread:s,onRemoveMessage:c,onUpdateMessage:l,syntaxTheme:u,cursor:d=null,fileIndex:f=0,onLineClick:p,commentTrigger:m,onCommentTriggerHandled:h,filename:g,onOpenInEditor:_}){let[v,y]=(0,A.useState)(null),[b,x]=(0,A.useState)(null),[S,C]=(0,A.useState)(!1),[w,T]=(0,A.useState)(null),[E,D]=(0,A.useState)(null);(0,A.useEffect)(()=>{if(m?.lineIndex!==void 0){let t=e.lines[m.lineIndex];if(t&&t.type!==`delete`){let e=t.newLineNumber;e&&(T({side:`new`,lineNumber:e}),h?.())}}},[m,e.lines,h]),(0,A.useEffect)(()=>{if(S){let e=()=>{C(!1),y(null),x(null)};return document.addEventListener(`mouseup`,e),()=>{document.removeEventListener(`mouseup`,e)}}},[S]);let O=(0,A.useCallback)((e,t)=>{w?.side===e&&w?.lineNumber===t?T(null):T({side:e,lineNumber:t})},[w]),k=(0,A.useCallback)(()=>{T(null)},[]),M=(0,A.useCallback)(()=>{if(!w)return``;let{side:t,lineNumber:n}=w,r=e.lines;if(typeof n==`number`)return r.find(e=>t===`old`?e.oldLineNumber===n:e.newLineNumber===n)?.content?.replace(/^[+-]/,``)||``;{let[e,i]=n;return r.filter(n=>{let r=t===`old`?n.oldLineNumber:n.newLineNumber;return r!==void 0&&r>=e&&r<=i}).map(e=>e.content?.replace(/^[+-]/,``)||``).join(`
57
+ `)}},[w,e.lines]),N=(0,A.useCallback)(async e=>{if(w!==null){let t=M();await i(w.lineNumber,e,t||void 0,w.side),T(null)}},[w,i,M]),P=(e,t)=>n.filter(n=>{let r=Array.isArray(n.line)?n.line[1]===e:n.line===e,i=!n.side||n.side===t;return r&&i}).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)),ee=e=>e.oldLine?.type===`delete`&&e.newLine?.type===`add`?e.newLineNumber?`right`:`left`:e.oldLine?.type===`delete`?`left`:e.newLine?.type===`add`?`right`:`full`,F=(e,t)=>{let n=e===`old`?t.oldLineNumber:t.newLineNumber;if(!n)return``;if(S&&v&&b&&v.side===e&&b.side===e){let e=Math.min(v.lineNumber,b.lineNumber),t=Math.max(v.lineNumber,b.lineNumber);if(n>=e&&n<=t){let r=`after:bg-blue-100 after:absolute after:inset-0 after:opacity-30 after:border-l-4 after:border-blue-500 after:pointer-events-none`;return n===e&&(r+=` after:border-t-2`),n===t&&(r+=` after:border-b-2`),r}}if(w&&w.side===e){let e=Array.isArray(w.lineNumber)?w.lineNumber:[w.lineNumber,w.lineNumber],t=e[0],r=e[1];if(t!==void 0&&r!==void 0&&n>=t&&n<=r)return`after:bg-diff-selected-bg after:absolute after:inset-0 after:border-l-5 after:border-l-diff-selected-border after:pointer-events-none`}return``},I=(0,A.useCallback)(t=>{let n=[],r=e.oldStart,i=e.newStart,a=0;for(;a<t.length;){let e=t[a];if(!e){a++;continue}if(e.type===`normal`)n.push({oldLine:e,newLine:{...e},oldLineNumber:e.oldLineNumber??r,newLineNumber:e.newLineNumber??i,oldLineOriginalIndex:a,newLineOriginalIndex:a}),r++,i++,a++;else if(e.type===`delete`){let e=a+1;for(;e<t.length&&t[e]?.type===`delete`;)e++;let o=t.slice(a,e),s=a,c=[],l=e;for(;e<t.length&&t[e]?.type===`add`;){let n=t[e];n&&c.push(n),e++}let u=Math.max(o.length,c.length);for(let e=0;e<u;e++){let t=o[e],a=c[e],u;t&&a&&xv(t.content,a.content)&&(u=bv(t.content,a.content)),n.push({oldLine:t,newLine:a,oldLineNumber:t?t.oldLineNumber??r+e:void 0,newLineNumber:a?a.newLineNumber??i+e:void 0,oldLineOriginalIndex:t?s+e:void 0,newLineOriginalIndex:a?l+e:void 0,wordLevelDiff:u})}r+=o.length,i+=c.length,a=e}else e.type===`add`&&(n.push({newLine:e,newLineNumber:e.newLineNumber??i,newLineOriginalIndex:a}),i++,a++)}return n},[e.oldStart,e.newStart]);return(0,j.jsx)(`div`,{className:`bg-github-bg-primary overflow-hidden`,children:(0,j.jsx)(`table`,{className:`w-full table-fixed border-collapse font-mono text-sm leading-5`,children:(0,j.jsx)(`tbody`,{children:(0,A.useMemo)(()=>I(e.lines),[e.lines,I]).map((e,n)=>{let i=e.oldLineNumber?P(e.oldLineNumber,`old`):[],m=e.newLineNumber?P(e.newLineNumber,`new`):[],h=[...i,...m],T=e.oldLineOriginalIndex??-1,I=e.newLineOriginalIndex??-1,te=d?d.side===`left`&&T>=0?d.chunkIndex===t&&d.lineIndex===T:d.side===`right`&&I>=0?d.chunkIndex===t&&d.lineIndex===I:!1:!1,ne=T>=0?`file-${f}-chunk-${t}-line-${T}-left`:void 0,re=I>=0?`file-${f}-chunk-${t}-line-${I}-right`:void 0,L=te&&d?.side===`left`,ie=te&&d?.side===`right`,R=`keyboard-cursor`;return(0,j.jsxs)(A.Fragment,{children:[(0,j.jsxs)(`tr`,{className:`group cursor-pointer`,onClick:e=>{if(!S){let n=e.target;if(!(n instanceof HTMLElement))return;let r=n.closest(`td:nth-child(1)`)||n.closest(`td:nth-child(2)`),i=n.closest(`td:nth-child(3)`)||n.closest(`td:nth-child(4)`);r&&T>=0?p?.(f,t,T,`left`):i&&I>=0&&p?.(f,t,I,`right`)}},onMouseEnter:t=>{let n=t.target;if(!(n instanceof HTMLElement))return;let r=n.closest(`td:nth-child(1)`)||n.closest(`td:nth-child(2)`),i=n.closest(`td:nth-child(3)`)||n.closest(`td:nth-child(4)`);r&&e.oldLineNumber?D({side:`old`,lineNumber:e.oldLineNumber}):i&&e.newLineNumber&&D({side:`new`,lineNumber:e.newLineNumber})},onMouseMove:t=>{let n=t.target;if(!(n instanceof HTMLElement))return;let r=n.closest(`td:nth-child(1)`)||n.closest(`td:nth-child(2)`),i=n.closest(`td:nth-child(3)`)||n.closest(`td:nth-child(4)`);r&&e.oldLineNumber?(E?.side!==`old`||E?.lineNumber!==e.oldLineNumber)&&D({side:`old`,lineNumber:e.oldLineNumber}):i&&e.newLineNumber&&(E?.side!==`new`||E?.lineNumber!==e.newLineNumber)&&D({side:`new`,lineNumber:e.newLineNumber}),S&&v&&(v.side===`old`&&e.oldLineNumber?x({side:`old`,lineNumber:e.oldLineNumber}):v.side===`new`&&e.newLineNumber&&x({side:`new`,lineNumber:e.newLineNumber}))},onMouseLeave:()=>D(null),children:[(0,j.jsxs)(`td`,{id:ne,className:`w-[var(--line-number-width)] min-w-[var(--line-number-width)] max-w-[var(--line-number-width)] px-2 text-right text-github-text-muted bg-github-bg-secondary border-r border-github-border select-none align-top relative overflow-visible ${L?R:``}`,children:[(0,j.jsx)(`span`,{children:e.oldLineNumber||``}),E?.side===`old`&&E?.lineNumber===e.oldLineNumber&&(0,j.jsxs)(j.Fragment,{children:[_&&g&&e.oldLine?.type!==`delete`&&e.newLineNumber!==void 0&&(0,j.jsx)(Cv,{onClick:()=>{let t=e.newLineNumber;!g||t===void 0||_(g,t)}}),(0,j.jsx)(Sv,{onMouseDown:t=>{t.stopPropagation(),e.oldLineNumber&&(y({side:`old`,lineNumber:e.oldLineNumber}),x({side:`old`,lineNumber:e.oldLineNumber}),C(!0))},onMouseUp:t=>{if(t.stopPropagation(),!e.oldLineNumber||!v){C(!1),y(null),x(null);return}let n=b&&b.side===`old`?b.lineNumber:e.oldLineNumber;v.side!==`old`||v.lineNumber===n?O(`old`,e.oldLineNumber):O(`old`,[Math.min(v.lineNumber,n),Math.max(v.lineNumber,n)]),C(!1),y(null),x(null)}})]})]}),(0,j.jsx)(`td`,{className:`w-1/2 p-0 align-top border-r border-github-border relative ${Dv(e.oldLine,Ev(e.oldLine))} ${F(`old`,e)} ${L?R:``}`,children:e.oldLine&&(0,j.jsx)(`div`,{className:`flex items-center relative min-h-[20px] px-3`,children:e.wordLevelDiff?(0,j.jsx)(Zn,{segments:e.wordLevelDiff.oldSegments,className:`flex-1 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text`}):(0,j.jsx)(Xn,{code:e.oldLine.content,className:`flex-1 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text [&_pre]:m-0 [&_pre]:p-0 [&_pre]:!bg-transparent [&_pre]:font-inherit [&_pre]:text-inherit [&_pre]:leading-inherit [&_code]:!bg-transparent [&_code]:font-inherit [&_code]:text-inherit [&_code]:leading-inherit`,syntaxTheme:u,filename:g})})}),(0,j.jsxs)(`td`,{id:re,className:`w-[var(--line-number-width)] min-w-[var(--line-number-width)] max-w-[var(--line-number-width)] px-2 text-right text-github-text-muted bg-github-bg-secondary border-r border-github-border select-none align-top relative overflow-visible ${ie?R:``}`,children:[(0,j.jsx)(`span`,{children:e.newLineNumber||``}),E?.side===`new`&&E?.lineNumber===e.newLineNumber&&(0,j.jsxs)(j.Fragment,{children:[_&&g&&e.newLineNumber!==void 0&&(0,j.jsx)(Cv,{onClick:()=>{let t=e.newLineNumber;!g||t===void 0||_(g,t)}}),(0,j.jsx)(Sv,{onMouseDown:t=>{t.stopPropagation(),e.newLineNumber&&(y({side:`new`,lineNumber:e.newLineNumber}),x({side:`new`,lineNumber:e.newLineNumber}),C(!0))},onMouseUp:t=>{if(t.stopPropagation(),!e.newLineNumber||!v){C(!1),y(null),x(null);return}let n=b&&b.side===`new`?b.lineNumber:e.newLineNumber;v.side!==`new`||v.lineNumber===n?O(`new`,e.newLineNumber):O(`new`,[Math.min(v.lineNumber,n),Math.max(v.lineNumber,n)]),C(!1),y(null),x(null)}})]})]}),(0,j.jsx)(`td`,{className:`w-1/2 p-0 align-top relative ${Dv(e.newLine,Ev(e.newLine))} ${F(`new`,e)} ${ie?R:``}`,children:e.newLine&&(0,j.jsx)(`div`,{className:`flex items-center relative min-h-[20px] px-3`,children:e.wordLevelDiff?(0,j.jsx)(Zn,{segments:e.wordLevelDiff.newSegments,className:`flex-1 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text`}):(0,j.jsx)(Xn,{code:e.newLine.content,className:`flex-1 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text [&_pre]:m-0 [&_pre]:p-0 [&_pre]:!bg-transparent [&_pre]:font-inherit [&_pre]:text-inherit [&_pre]:leading-inherit [&_code]:!bg-transparent [&_code]:font-inherit [&_code]:text-inherit [&_code]:leading-inherit`,syntaxTheme:u,filename:g})})})]}),h.length>0&&(0,j.jsx)(`tr`,{className:`bg-github-bg-secondary`,children:(0,j.jsx)(`td`,{colSpan:4,className:`p-0 border-t border-github-border`,children:h.map(t=>{let n=t.side||`new`,i;return i=n===`old`&&e.oldLineNumber?`left`:n===`new`&&e.newLineNumber?`right`:ee(e),(0,j.jsx)(`div`,{className:`flex ${i===`left`?`justify-start`:i===`right`?`justify-end`:`justify-center`}`,children:(0,j.jsx)(`div`,{className:`${i===`full`?`w-full`:`w-1/2`}`,children:(0,j.jsx)(`div`,{className:`m-2 mx-3`,children:(0,j.jsx)(ur,{thread:t,showAuthorBadges:r,onGeneratePrompt:a,onRemoveThread:o,onReplyToThread:s,onRemoveMessage:c,onUpdateMessage:l,syntaxTheme:u})})})},t.id)})})}),w&&(w.side===`old`&&w.lineNumber===e.oldLineNumber||w.side===`new`&&w.lineNumber===e.newLineNumber||Array.isArray(w.lineNumber)&&(w.side===`new`&&w.lineNumber[1]===e.newLineNumber||w.side===`old`&&w.lineNumber[1]===e.oldLineNumber))&&(0,j.jsx)(`tr`,{className:`bg-github-bg-secondary`,children:(0,j.jsx)(`td`,{colSpan:4,className:`p-0`,children:(0,j.jsx)(`div`,{className:`flex ${w.side===`old`?`justify-start`:w.side===`new`?`justify-end`:`justify-center`}`,children:(0,j.jsx)(`div`,{className:`w-1/2`,children:(0,j.jsx)(cr,{onSubmit:N,onCancel:k,selectedCode:M(),syntaxTheme:u,filename:g})})})})})]},n)})})})})}var kv=(0,A.memo)(function({chunk:e,chunkIndex:t,threads:n,showAuthorBadges:r=!1,onAddComment:i,onGenerateThreadPrompt:a,onRemoveThread:o,onReplyToThread:s,onRemoveMessage:c,onUpdateMessage:l,mode:u=mt,syntaxTheme:d,cursor:f=null,fileIndex:p=0,onLineClick:m,commentTrigger:h,onCommentTriggerHandled:g,filename:_,onOpenInEditor:v}){let[y,b]=(0,A.useState)(null),[x,S]=(0,A.useState)(null),[C,w]=(0,A.useState)(!1),[T,E]=(0,A.useState)(null),[D,O]=(0,A.useState)(null);(0,A.useEffect)(()=>{if(h?.lineIndex!==void 0){let t=e.lines[h.lineIndex];if(t){let e=t.newLineNumber||t.oldLineNumber,n=t.type===`delete`?`old`:`new`;e&&(E({side:n,lineNumber:e}),g?.())}}},[h,e.lines,g]),(0,A.useEffect)(()=>{if(C){let e=()=>{w(!1),b(null),S(null)};return document.addEventListener(`mouseup`,e),()=>{document.removeEventListener(`mouseup`,e)}}},[C]);let k=(0,A.useCallback)((e,t)=>{T?.side===e&&T?.lineNumber===t?E(null):E({side:e,lineNumber:t})},[T]),M=(0,A.useCallback)(()=>{E(null)},[]),N=(0,A.useCallback)(()=>{if(!T)return``;let{side:t,lineNumber:n}=T,r=e.lines;if(typeof n==`number`)return r.find(e=>t===`old`?e.oldLineNumber===n:e.newLineNumber===n)?.content?.replace(/^[+-]/,``)||``;{let[e,i]=n;return r.filter(n=>{let r=t===`old`?n.oldLineNumber:n.newLineNumber;return r!==void 0&&r>=e&&r<=i}).map(e=>e.content?.replace(/^[+-]/,``)||``).join(`
58
+ `)}},[T,e.lines]),P=(0,A.useCallback)(async e=>{if(T!==null){let t=N();await i(T.lineNumber,e,t||void 0,T.side),E(null)}},[T,i,N]),ee=(e,t)=>n.filter(n=>{let r=Array.isArray(n.line)?n.line[1]===e:n.line===e,i=!n.side||n.side===t;return r&&i}).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)),F=e=>{if(u===`unified`)return`full`;switch(e.type){case`delete`:return`left`;case`add`:return`right`;default:return`full`}},I=(e,t)=>{if(!e)return``;if(C&&y&&x){let t=Math.min(y,x),n=Math.max(y,x);if(e>=t&&e<=n){let r=`after:bg-blue-100 after:absolute after:inset-0 after:opacity-30 after:border-l-4 after:border-blue-500 after:pointer-events-none`;return e===t&&(r+=` after:border-t-2`),e===n&&(r+=` after:border-b-2`),r}}if(T&&T.side===t){let t=Array.isArray(T.lineNumber)?T.lineNumber[0]:T.lineNumber,n=Array.isArray(T.lineNumber)?T.lineNumber[1]:T.lineNumber;if(e>=t&&e<=n)return`after:bg-diff-selected-bg after:absolute after:inset-0 after:border-l-5 after:border-l-diff-selected-border after:pointer-events-none`}return``},te=(0,A.useMemo)(()=>{let t=new Map,n=e.lines,r=0;for(;r<n.length;){let e=n[r];if(!e){r++;continue}if(e.type===`delete`){let e=r+1;for(;e<n.length&&n[e]?.type===`delete`;)e++;let i=n.slice(r,e),a=r,o=[];for(;e<n.length&&n[e]?.type===`add`;){let t=n[e];t&&o.push({line:t,index:e}),e++}let s=Math.max(i.length,o.length);for(let e=0;e<s;e++){let n=i[e],r=o[e];if(n&&r&&xv(n.content,r.line.content)){let i=bv(n.content,r.line.content);t.set(a+e,i.oldSegments),t.set(r.index,i.newSegments)}}r=e}else r++}return t},[e.lines]);return u===`split`?(0,j.jsx)(Ov,{chunk:e,chunkIndex:t,threads:n,showAuthorBadges:r,onAddComment:i,onGenerateThreadPrompt:a,onRemoveThread:o,onReplyToThread:s,onRemoveMessage:c,onUpdateMessage:l,onOpenInEditor:v,syntaxTheme:d,cursor:f,fileIndex:p,onLineClick:m,filename:_,commentTrigger:h,onCommentTriggerHandled:g}):(0,j.jsx)(`div`,{className:`bg-github-bg-primary`,children:(0,j.jsx)(`table`,{className:`w-full table-fixed border-collapse font-mono text-sm leading-5`,children:(0,j.jsx)(`tbody`,{children:e.lines.map((e,n)=>{let i=e.newLineNumber||e.oldLineNumber||0,u=e.type===`delete`?`old`:`new`,h=T?Array.isArray(T.lineNumber)?T.lineNumber[1]:T.lineNumber:null,g=e.type===`delete`?e.oldLineNumber:e.newLineNumber,E=e.type===`delete`?`old`:`new`,ne=g?ee(g,E):[],re=`file-${p}-chunk-${t}-line-${n}`,L=f&&f.chunkIndex===t&&f.lineIndex===n;return(0,j.jsxs)(A.Fragment,{children:[(0,j.jsx)(Tv,{line:e,index:n,lineId:re,isCurrentLine:L||!1,hoveredLineIndex:D,selectedLineStyle:I(e.newLineNumber||e.oldLineNumber,e.type===`delete`?`old`:`new`),onMouseEnter:()=>{O(n)},onMouseLeave:()=>O(null),onMouseMove:()=>{if(C&&y){let t=e.newLineNumber||e.oldLineNumber;t&&S(t)}},onCommentButtonMouseDown:t=>{t.stopPropagation();let n=e.newLineNumber||e.oldLineNumber;n&&(b(n),S(n),w(!0))},onCommentButtonMouseUp:t=>{t.stopPropagation();let n=e.newLineNumber||e.oldLineNumber,r=e.type===`delete`?`old`:`new`;if(!n||!y){w(!1),b(null),S(null);return}let i=x||n;y===i?k(r,n):k(r,[Math.min(y,i),Math.max(y,i)]),w(!1),b(null),S(null)},onOpenInEditor:v&&_&&e.type!==`delete`&&(e.newLineNumber||e.oldLineNumber)?()=>{let t=e.newLineNumber||e.oldLineNumber;t&&_&&v(_,t)}:void 0,syntaxTheme:d,filename:_,diffSegments:te.get(n),onClick:()=>{let r=e.type===`delete`?`left`:`right`;m?.(p,t,n,r)}}),ne.map(t=>{let n=F(e);return(0,j.jsx)(`tr`,{className:`bg-github-bg-secondary`,children:(0,j.jsx)(`td`,{colSpan:3,className:`p-0 border-t border-github-border`,children:(0,j.jsx)(`div`,{className:`flex ${n===`left`?`justify-start`:n===`right`?`justify-end`:`justify-center`}`,children:(0,j.jsx)(`div`,{className:`${n===`full`?`w-full`:`w-1/2`} m-2 mx-4`,children:(0,j.jsx)(ur,{thread:t,showAuthorBadges:r,onGeneratePrompt:a,onRemoveThread:o,onReplyToThread:s,onRemoveMessage:c,onUpdateMessage:l,syntaxTheme:d})})})})},t.id)}),T&&T.side===u&&h===i&&(0,j.jsx)(`tr`,{className:`bg-[var(--bg-secondary)]`,children:(0,j.jsx)(`td`,{colSpan:3,className:`p-0`,children:(0,j.jsx)(`div`,{className:`flex ${F(e)===`left`?`justify-start`:F(e)===`right`?`justify-end`:`justify-center`}`,children:(0,j.jsx)(`div`,{className:`${F(e)===`full`?`w-full`:`w-1/2`}`,children:(0,j.jsx)(cr,{onSubmit:P,onCancel:M,selectedCode:N(),syntaxTheme:d,filename:_})})})})})]},n)})})})})}),Av=20,jv=(0,A.memo)(function({direction:e,hiddenLines:t,onExpandUp:n,onExpandDown:r,onExpandAll:i,isLoading:a=!1}){if(t<=0)return null;let o=`${t} ${t===1?`line`:`lines`}`,s=t<=Av,c=[];return s?c.push({key:`all`,onClick:i,ariaLabel:`Expand all ${t} hidden lines`,icon:(0,j.jsx)(ft,{size:16,"aria-hidden":`true`})}):((e===`up`||e===`both`)&&c.push({key:`up`,onClick:n,ariaLabel:`Expand ${Av} hidden lines above`,icon:(0,j.jsx)(Me,{size:12,"aria-hidden":`true`,className:`translate-y-0.5`})}),(e===`down`||e===`both`)&&c.push({key:`down`,onClick:r,ariaLabel:`Expand ${Av} hidden lines below`,icon:(0,j.jsx)(je,{size:12,"aria-hidden":`true`,className:`-translate-y-0.5`})})),(0,j.jsxs)(`div`,{className:`grid w-full border-l border-r border-github-border bg-github-bg-tertiary text-sm grid-cols-[var(--line-number-width)_1fr]`,children:[(0,j.jsx)(`div`,{className:`flex flex-col items-stretch justify-center gap-0.5 border-r border-github-border`,children:a?(0,j.jsx)(et,{size:14,className:`animate-spin text-github-text-muted self-center`,"aria-hidden":`true`}):c.map(e=>(0,j.jsx)(`button`,{type:`button`,onClick:e.onClick,disabled:a||!e.onClick,className:`flex flex-1 w-full items-center justify-center py-1 text-github-text-primary hover:bg-github-bg-secondary hover:text-github-text-muted transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed`,title:e.ariaLabel,"aria-label":e.ariaLabel,children:e.icon},e.key))}),(0,j.jsx)(`div`,{className:`flex items-center justify-start px-3 py-1.5 font-mono text-github-text-muted select-none`,children:o})]})});function Mv({file:e,threads:t,showAuthorBadges:n,diffMode:r,syntaxTheme:i,cursor:a,fileIndex:o,mergedChunks:s,isExpandLoading:c,expandHiddenLines:l,expandAllBetweenChunks:u,onAddComment:d,onGenerateThreadPrompt:f,onRemoveThread:p,onReplyToThread:m,onRemoveMessage:h,onUpdateMessage:g,onLineClick:_,onOpenInEditor:v,commentTrigger:y,onCommentTriggerHandled:b}){let x=(t,n,r,i)=>t===`top`&&n.hiddenLinesBefore>0?(0,j.jsx)(jv,{direction:`down`,hiddenLines:n.hiddenLinesBefore,onExpandDown:()=>l(e,r,`up`),onExpandAll:()=>u(e,r,n.hiddenLinesBefore),isLoading:c}):t===`middle`&&n.hiddenLinesBefore>0?(0,j.jsx)(jv,{direction:`both`,hiddenLines:n.hiddenLinesBefore,onExpandUp:()=>l(e,r-1,`down`),onExpandDown:()=>l(e,r,`up`),onExpandAll:()=>u(e,r,n.hiddenLinesBefore),isLoading:c}):t===`bottom`&&n.hiddenLinesAfter>0?(0,j.jsx)(jv,{direction:`up`,hiddenLines:n.hiddenLinesAfter,onExpandUp:()=>l(e,i,`down`),onExpandAll:()=>l(e,i,`down`,n.hiddenLinesAfter),isLoading:c}):null;return(0,j.jsx)(j.Fragment,{children:s.map((c,l)=>{let u=l===0,S=l===s.length-1,C=c.originalIndices[0]??0,w=c.originalIndices[c.originalIndices.length-1]??0;return(0,j.jsxs)(A.Fragment,{children:[u&&x(`top`,c,C,w),!u&&x(`middle`,c,C,w),(0,j.jsx)(`div`,{id:`chunk-${e.path.replace(/[^a-zA-Z0-9]/g,`-`)}-${l}`,children:(0,j.jsx)(kv,{chunk:c,chunkIndex:l,threads:t,showAuthorBadges:n,onAddComment:d,onGenerateThreadPrompt:f,onRemoveThread:p,onReplyToThread:m,onRemoveMessage:h,onUpdateMessage:g,onOpenInEditor:v,mode:r,syntaxTheme:i,cursor:a&&a.chunkIndex===l?a:null,fileIndex:o,onLineClick:_,commentTrigger:y&&y.chunkIndex===l?y:null,onCommentTriggerHandled:b,filename:e.path})}),S&&x(`bottom`,c,C,w)]},l)})})}var Nv=e=>!!(e&&e!==`stdin`),Pv=[`text-[26px] font-semibold`,`text-[22px] font-semibold`,`text-xl font-semibold`,`text-lg font-semibold`,`text-base font-semibold uppercase tracking-wide`,`text-base font-semibold`],Fv=e=>e.type===`delete`||e.type===`remove`,Iv=e=>e.type===`normal`||e.type===`context`,Lv=e=>/^(https?:|mailto:|#|\.{0,2}\/|\/)/i.test(e.trim()),Rv=(e,t,n)=>{let r=e[e.length-1];if(r&&r.type===t){r.lines.push(n);return}e.push({type:t,lines:[n]})},zv=(e,t)=>{t.forEach(t=>Rv(e,`delete`,t)),t.length=0},Bv=e=>{let t=[],n=[],r=!1;return e.forEach(e=>{e.lines.forEach(e=>{if(!(e.type===`header`||e.type===`hunk`)){if(Fv(e)){n.push(e.content);return}if(e.type===`add`){n.length>0&&(zv(t,n),r=!0),Rv(t,r?`change`:`add`,e.content);return}Iv(e)&&(zv(t,n),r=!1,Rv(t,`context`,e.content))}}),zv(t,n),r=!1}),t},Vv=e=>A.isValidElement(e),Hv=e=>A.isValidElement(e),Uv=e=>e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Uv).join(``):Vv(e)?Uv(e.props.children):``,Wv=e=>({h1:({children:e})=>(0,j.jsx)(`h1`,{className:`${Pv[0]} mt-6 mb-2 first:mt-0`,children:e}),h2:({children:e})=>(0,j.jsx)(`h2`,{className:`${Pv[1]} mt-6 mb-2 first:mt-0`,children:e}),h3:({children:e})=>(0,j.jsx)(`h3`,{className:`${Pv[2]} mt-6 mb-2 first:mt-0`,children:e}),h4:({children:e})=>(0,j.jsx)(`h4`,{className:`${Pv[3]} mt-6 mb-2 first:mt-0`,children:e}),h5:({children:e})=>(0,j.jsx)(`h5`,{className:`${Pv[4]} mt-6 mb-2 first:mt-0`,children:e}),h6:({children:e})=>(0,j.jsx)(`h6`,{className:`${Pv[5]} mt-6 mb-2 first:mt-0`,children:e}),p:({children:e})=>(0,j.jsx)(`p`,{className:`text-base leading-7`,children:e}),ul:({children:e})=>(0,j.jsx)(`ul`,{className:`list-disc pl-6 text-base space-y-1`,children:e}),ol:({children:e})=>(0,j.jsx)(`ol`,{className:`list-decimal pl-6 text-base space-y-1`,children:e}),li:({children:e})=>(0,j.jsx)(`li`,{children:e}),blockquote:({children:e})=>(0,j.jsx)(`blockquote`,{className:`border-l-4 border-github-border pl-4 text-github-text-muted italic`,children:e}),hr:()=>(0,j.jsx)(`hr`,{className:`border-github-border`}),a:({href:e,children:t})=>{let n=e??``;if(!n||!Lv(n))return(0,j.jsx)(`span`,{children:t});let r=n.startsWith(`http`);return(0,j.jsx)(`a`,{href:n,target:r?`_blank`:void 0,rel:r?`noreferrer`:void 0,className:`text-sky-400 hover:text-sky-300 underline underline-offset-4`,children:t})},img:({src:e,alt:t})=>{let n=e??``;return!n||!Lv(n)?null:(0,j.jsx)(`img`,{src:n,alt:t??``,loading:`lazy`,className:`max-w-full rounded border border-github-border`})},pre:({children:t})=>{let n=(Array.isArray(t)?t:[t]).find(Hv),r=Uv(n??t),i=/language-(\S+)/.exec(n?.props.className??``)?.[1],a=r.replace(/\n$/,``);return i===`mermaid`&&a.trim()?(0,j.jsx)(q_,{chart:a}):r.trim()?(0,j.jsx)(`pre`,{className:`markdown-preview-code border border-github-border bg-github-bg-secondary p-3 overflow-x-auto text-sm`,children:(0,j.jsx)(Yn,{code:a,language:i,syntaxTheme:e,className:`font-mono text-github-text-primary`})}):(0,j.jsx)(`pre`,{className:`markdown-preview-code border border-github-border bg-github-bg-secondary p-3 overflow-x-auto text-sm`,children:t})},code:({className:e,children:t})=>e?(0,j.jsx)(`code`,{className:e,children:t}):(0,j.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-github-bg-tertiary border border-github-border text-sm font-mono`,children:t}),table:({children:e})=>(0,j.jsx)(`div`,{className:`overflow-x-auto`,children:(0,j.jsx)(`table`,{className:`w-full border-collapse text-sm`,children:e})}),thead:({children:e})=>(0,j.jsx)(`thead`,{className:`bg-github-bg-secondary`,children:e}),tbody:({children:e})=>(0,j.jsx)(`tbody`,{children:e}),tr:({children:e})=>(0,j.jsx)(`tr`,{className:`border-b border-github-border`,children:e}),th:({children:e})=>(0,j.jsx)(`th`,{className:`px-3 py-2 text-left font-semibold border border-github-border`,children:e}),td:({children:e})=>(0,j.jsx)(`td`,{className:`px-3 py-2 border border-github-border`,children:e})}),Gv=e=>{switch(e){case`add`:return`border-l-4 border-diff-addition-border`;case`delete`:return`border-l-4 border-diff-deletion-border`;case`change`:return`border-l-4 border-diff-addition-border`;default:return`border-l-4 border-transparent`}},Kv=e=>/^\s*\[[^\]]+\]:\s+\S+/.test(e),qv=e=>/^\s*\[\^[^\]]+\]:\s+/.test(e),Jv=e=>{let t=e.trim();return t.length>=7&&t.startsWith(`<!--`)&&t.endsWith(`-->`)},Yv=e=>e.trim()===``||Kv(e)||qv(e)||Jv(e),Xv=e=>e.every(Yv),Zv=e=>{let t=e.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if(!t)return null;let n=t[1];return n?{marker:n[0],length:n.length,raw:e}:null},Qv=(e,t)=>{let n=e.match(/^\s{0,3}(`{3,}|~{3,})\s*$/);return n?.[1]?n[1][0]===t.marker&&n[1].length>=t.length:!1},$v=e=>{let t=[],n=null,r=null,i=()=>{n&&=(t.push(n),null)},a=(e,t)=>{if(n?.type===e){n.lines.push(t);return}i(),n={kind:`markdown`,type:e,lines:[t]}},o=e=>{if(!r)return;let n=r.lines.every(e=>e.type===`context`);e&&n?(a(`context`,r.fence.raw),r.lines.forEach(e=>{a(`context`,e.content)}),a(`context`,e)):(i(),t.push({kind:`fenced-code`,lines:r.lines})),r=null};return e.forEach(e=>{e.lines.forEach(t=>{if(r){if(Qv(t,r.fence)){o(t);return}r.lines.push({type:e.type,content:t});return}let n=Zv(t);if(n){i(),r={fence:n,lines:[]};return}a(e.type,t)})}),o(),i(),t},ey=e=>{switch(e){case`add`:case`change`:return`border-l-4 border-diff-addition-border bg-diff-addition-bg`;case`delete`:return`border-l-4 border-diff-deletion-border bg-diff-deletion-bg`;default:return`border-l-4 border-transparent`}},ty=({blocks:e,syntaxTheme:t})=>{let n=(0,A.useMemo)(()=>Wv(t),[t]);return(0,j.jsx)(`div`,{className:`space-y-4`,children:(0,A.useMemo)(()=>$v(e),[e]).map((e,t)=>{if(e.kind===`fenced-code`)return(0,j.jsx)(`div`,{className:`px-4`,children:(0,j.jsx)(`div`,{className:`markdown-preview-code overflow-x-auto rounded border border-github-border bg-github-bg-secondary text-sm font-mono text-github-text-primary`,children:e.lines.map((e,n)=>(0,j.jsx)(`div`,{className:`${ey(e.type)} whitespace-pre px-3 py-1`,children:e.content||` `},`preview-code-line-${t}-${n}`))})},`preview-block-${t}`);let r=e.lines.join(`
59
+ `).trim();if(!r)return null;let i=Xv(e.lines);return(0,j.jsx)(`div`,{className:`px-4 ${Gv(e.type)}`,children:i?(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm text-github-text-primary font-mono`,children:r}):(0,j.jsx)(zm,{remarkPlugins:[U_],urlTransform:e=>Lv(e)?e:``,components:n,children:r})},`preview-block-${t}`)})})},ny=({content:e,syntaxTheme:t})=>{let n=(0,A.useMemo)(()=>Wv(t),[t]);return(0,j.jsx)(`div`,{className:`space-y-4`,children:(0,j.jsx)(zm,{remarkPlugins:[U_],urlTransform:e=>Lv(e)?e:``,components:n,children:e})})};function ry(e){let{file:t,baseCommitish:n,targetCommitish:r,mergedChunks:i,syntaxTheme:a}=e,[o,s]=(0,A.useState)(`diff`),[c,l]=(0,A.useState)(null),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(null),[m,h]=(0,A.useState)(null),g=(0,A.useMemo)(()=>Bv(i),[i]),_=(0,A.useMemo)(()=>!n&&!r?null:t.status===`added`?r?{path:t.path,ref:r}:null:t.status===`deleted`?n?{path:t.oldPath||t.path,ref:n}:null:r?{path:t.path,ref:r}:n?{path:t.oldPath||t.path,ref:n}:null,[n,r,t.path,t.oldPath,t.status]),v=(0,A.useMemo)(()=>_?`${_.ref}:${_.path}`:null,[_]);(0,A.useEffect)(()=>{if(!_||!v||!Nv(_.ref)){l(null),h(null),p(null),d(!1);return}let e=!1;return(v!==m||c===null)&&(async()=>{v!==m&&l(null),d(!0),p(null);try{let t=encodeURIComponent(_.path),n=await fetch(`/api/blob/${t}?ref=${encodeURIComponent(_.ref)}`);if(!n.ok)throw Error(`Failed to fetch preview: ${n.statusText}`);let r=await n.text();e||(l(r),h(v))}catch(t){e||(l(null),h(null),p(t instanceof Error?t.message:`Failed to load preview`))}finally{e||d(!1)}})(),()=>{e=!0}},[c,m,_,v]);let y=(0,A.useMemo)(()=>v===m&&c!==null,[c,m,v]);return(0,A.useEffect)(()=>{o===`full-preview`&&!y&&s(`diff-preview`)},[y,o]),(0,j.jsxs)(`div`,{className:`bg-github-bg-primary`,children:[(0,j.jsx)(`div`,{className:`flex items-center justify-between border-b border-github-border px-4 py-2`,children:(0,j.jsx)(J_,{mode:o,hasFullPreview:y,onModeChange:s})}),o===`diff`&&(0,j.jsx)(Mv,{...e}),o===`diff-preview`&&(0,j.jsx)(`div`,{className:`p-4`,children:(0,j.jsx)(ty,{blocks:g,syntaxTheme:a})}),o===`full-preview`&&(0,j.jsxs)(`div`,{className:`p-4`,children:[u&&(0,j.jsx)(`div`,{className:`text-sm text-github-text-muted mb-3`,children:`Loading preview...`}),f&&(0,j.jsx)(`div`,{className:`text-sm text-github-danger mb-3`,children:f}),!u&&!f&&c!==null&&(0,j.jsx)(ny,{content:c,syntaxTheme:a}),!u&&!f&&c===null&&(0,j.jsx)(`div`,{className:`text-sm text-github-text-muted`,children:`Preview unavailable.`})]})]})}var iy=[`text-2xl font-semibold`,`text-xl font-semibold`,`text-lg font-semibold`,`text-base font-semibold`,`text-sm font-semibold uppercase tracking-wide`,`text-sm font-semibold`],ay={markdown:`Markdown`,code:`Code`,raw:`Raw`,unknown:`Cell`},oy=/"cell_type"\s*:\s*"([^"]+)"/,sy=/"source"\s*:/,cy=/"execution_count"\s*:\s*(null|[0-9]+)/,ly=/"id"\s*:\s*"([^"]+)"/,uy=e=>e.type===`delete`||e.type===`remove`,dy=e=>e.type===`normal`||e.type===`context`,fy=e=>e.type===`add`?`add`:uy(e)?`delete`:dy(e)?`context`:null,py=e=>e===`markdown`||e===`code`||e===`raw`?e:`unknown`,my=e=>{let t=e.trim();if(!t.startsWith(`"`))return null;let n=t;n.endsWith(`,`)&&(n=n.slice(0,-1));try{let e=JSON.parse(n);return typeof e==`string`?e:null}catch{return n.replace(/^"/,``).replace(/"$/,``).replace(/\\n/g,`
60
+ `).replace(/\\t/g,` `).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}},hy=e=>{let t=e.indexOf(`"source"`);if(t===-1)return null;let n=e.indexOf(`:`,t);if(n===-1)return null;let r=e.slice(n+1).trim();if(!r)return null;if(r.endsWith(`,`)&&(r=r.slice(0,-1).trim()),r.startsWith(`[`)){let e=r.lastIndexOf(`]`);if(e===-1)return null;let t=r.slice(0,e+1);try{let e=JSON.parse(t);if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}catch{return null}return[]}if(r.startsWith(`"`))try{let e=JSON.parse(r);return typeof e==`string`?[e]:null}catch{return null}return null},gy=e=>{let t=_y(e);if(t)return t;let n=[],r=null,i=!1,a=!1,o=!1,s=()=>{r&&(r.status=i&&a?`change`:i?`add`:a?`delete`:`context`,n.push(r),r=null,i=!1,a=!1,o=!1)},c=e=>{s(),r={cellType:e,sourceLines:[],status:`context`}};return e.forEach(e=>{e.lines.forEach(e=>{let t=fy(e);if(!t)return;let n=e.content.match(oy);if(n?c(py(n[1]??``)):!r&&sy.test(e.content)&&c(`unknown`),!r)return;if(t===`add`&&(i=!0),t===`delete`&&(a=!0),!r.id){let t=e.content.match(ly);t&&(r.id=t[1])}if(r.executionCount===void 0){let t=e.content.match(cy);t&&(r.executionCount=t[1]===`null`?null:t[1])}if(sy.test(e.content)){let n=hy(e.content);if(n){n.forEach(e=>{r?.sourceLines.push({type:t,content:e})}),o=!1;return}o=!0;return}if(!o)return;if(e.content.trim().startsWith(`]`)){o=!1;return}let s=my(e.content);s!==null&&r.sourceLines.push({type:t,content:s})})}),s(),{cells:n}},_y=e=>{let t=vy(e,[`add`,`context`]),n=vy(e,[`delete`,`context`]),r=yy(t),i=yy(n);if(!r&&!i||r&&r.cells.length===0&&!i)return null;let a=r?.language??i?.language;return{cells:Cy(i?.cells??[],r?.cells??[]),language:a}},vy=(e,t)=>e.flatMap(e=>e.lines).map(e=>{let n=fy(e);return!n||!t.includes(n)?null:e.content}).filter(e=>e!==null).join(`
61
+ `),yy=e=>{if(!e.trim())return null;try{let t=JSON.parse(e);if(!t||typeof t!=`object`||!(`cells`in t))return null;let n=t.cells;if(!Array.isArray(n))return null;let r=t.metadata,i=by(r);return{cells:n.map(e=>xy(e)),language:i}}catch{return null}},by=e=>{if(!e||typeof e!=`object`)return;let t=e,n=t.language_info;if(n&&typeof n==`object`){let e=n.name;if(typeof e==`string`&&e.trim())return e}let r=t.kernelspec;if(r&&typeof r==`object`){let e=r.language;if(typeof e==`string`&&e.trim())return e}},xy=e=>{let t=typeof e==`object`&&e?e:{},n=py(typeof t.cell_type==`string`?t.cell_type:``),r=typeof t.id==`string`?t.id:void 0,i=t.execution_count,a=i===null?null:typeof i==`number`?String(i):typeof i==`string`?i:void 0;return{cellType:n,sourceText:Sy(t.source),id:r,executionCount:a}},Sy=e=>typeof e==`string`?e:Array.isArray(e)?e.filter(e=>typeof e==`string`).join(``):``,Cy=(e,t)=>{let n=[];if(e.some(e=>!!e.id)||t.some(e=>!!e.id)){let r=new Map;e.forEach((e,t)=>{e.id&&r.set(e.id,{cell:e,index:t})});let i=new Set;return t.forEach(e=>{let t=e.id?r.get(e.id):void 0;t&&i.add(t.index),n.push(wy(t?.cell??null,e))}),e.forEach((e,t)=>{i.has(t)||n.push(wy(e,null))}),n}let r=Math.max(e.length,t.length);for(let i=0;i<r;i+=1){let r=e[i]??null,a=t[i]??null;n.push(wy(r,a))}return n},wy=(e,t)=>{if(!t&&e)return{cellType:e.cellType,sourceLines:Ty(e.sourceText,`delete`),status:`delete`,id:e.id,executionCount:e.executionCount};if(t&&!e)return{cellType:t.cellType,sourceLines:Ty(t.sourceText,`add`),status:`add`,id:t.id,executionCount:t.executionCount};let n=e?.sourceText??``,r=t?.sourceText??``,i=t?.cellType??e?.cellType??`unknown`,a=t?.id??e?.id,o=t?.executionCount??e?.executionCount;return n===r&&(e?.cellType??``)===(t?.cellType??``)?{cellType:i,sourceLines:Ty(r,`context`),status:`context`,id:a,executionCount:o}:{cellType:i,sourceLines:[...Ty(n,`delete`),...Ty(r,`add`)],status:`change`,id:a,executionCount:o}},Ty=(e,t)=>e?[{type:t,content:e}]:[],Ey=e=>!!(e&&e!==`stdin`),Dy=async(e,t)=>{let n=await fetch(`/api/blob/${encodeURIComponent(e)}?ref=${encodeURIComponent(t)}`);return n.ok?n.text():null},Oy=(e,t)=>e.filter(e=>t.includes(e.type)).map(e=>e.content).join(``),ky=e=>{if(!e)return[];let t=e.split(`
62
+ `);return t.length>0&&t[t.length-1]===``&&t.pop(),t},Ay=(e,t)=>!e&&!t?[]:e?t?gv(e,t).flatMap(e=>{let t=e.added?`add`:e.removed?`delete`:`context`;return ky(e.value).map(e=>({type:t,content:e}))}):ky(e).map(e=>({type:`delete`,content:e})):ky(t).map(e=>({type:`add`,content:e})),jy=e=>A.isValidElement(e),My=e=>A.isValidElement(e),Ny=e=>e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Ny).join(``):jy(e)?Ny(e.props.children):``,Py=e=>{switch(e){case`add`:return`border-l-4 border-diff-addition-border`;case`delete`:return`border-l-4 border-diff-deletion-border`;case`change`:return`border-l-4 border-diff-addition-border`;default:return`border-l-4 border-transparent`}},Fy=e=>{switch(e){case`before`:return`border-l-4 border-diff-deletion-border`;case`after`:return`border-l-4 border-diff-addition-border`;default:return`border-l-4 border-transparent`}},Iy=e=>{switch(e){case`add`:return`bg-diff-addition-bg`;case`delete`:return`bg-diff-deletion-bg`;default:return`bg-transparent`}},Ly=e=>{switch(e){case`add`:return`+`;case`delete`:return`-`;default:return` `}},Ry=e=>{switch(e){case`add`:return`text-github-accent`;case`delete`:return`text-github-danger`;default:return`text-github-text-muted`}},zy=e=>/^(https?:|mailto:|#|\.{0,2}\/|\/)/i.test(e.trim()),By=e=>({h1:({children:e})=>(0,j.jsx)(`h1`,{className:`${iy[0]} mb-2`,children:e}),h2:({children:e})=>(0,j.jsx)(`h2`,{className:`${iy[1]} mb-2`,children:e}),h3:({children:e})=>(0,j.jsx)(`h3`,{className:`${iy[2]} mb-2`,children:e}),h4:({children:e})=>(0,j.jsx)(`h4`,{className:`${iy[3]} mb-2`,children:e}),h5:({children:e})=>(0,j.jsx)(`h5`,{className:`${iy[4]} mb-2`,children:e}),h6:({children:e})=>(0,j.jsx)(`h6`,{className:`${iy[5]} mb-2`,children:e}),p:({children:e})=>(0,j.jsx)(`p`,{className:`text-sm leading-7`,children:e}),ul:({children:e})=>(0,j.jsx)(`ul`,{className:`list-disc pl-6 text-sm space-y-1`,children:e}),ol:({children:e})=>(0,j.jsx)(`ol`,{className:`list-decimal pl-6 text-sm space-y-1`,children:e}),li:({children:e})=>(0,j.jsx)(`li`,{children:e}),blockquote:({children:e})=>(0,j.jsx)(`blockquote`,{className:`border-l-4 border-github-border pl-4 text-github-text-muted italic`,children:e}),hr:()=>(0,j.jsx)(`hr`,{className:`border-github-border`}),a:({href:e,children:t})=>{let n=e??``;if(!n||!zy(n))return(0,j.jsx)(`span`,{children:t});let r=n.startsWith(`http`);return(0,j.jsx)(`a`,{href:n,target:r?`_blank`:void 0,rel:r?`noreferrer`:void 0,className:`text-sky-400 hover:text-sky-300 underline underline-offset-4`,children:t})},img:({src:e,alt:t})=>{let n=e??``;return!n||!zy(n)?null:(0,j.jsx)(`img`,{src:n,alt:t??``,loading:`lazy`,className:`max-w-full rounded border border-github-border`})},pre:({children:t})=>{let n=(Array.isArray(t)?t:[t]).find(My),r=Ny(n??t),i=/language-(\S+)/.exec(n?.props.className??``)?.[1];return r.trim()?(0,j.jsx)(`pre`,{className:`border border-github-border bg-github-bg-secondary p-3 overflow-x-auto text-xs`,children:(0,j.jsx)(Yn,{code:r.replace(/\n$/,``),language:i,syntaxTheme:e,className:`font-mono text-github-text-primary [&_.token-line]:block [&_.token-line]:whitespace-pre`})}):(0,j.jsx)(`pre`,{className:`border border-github-border bg-github-bg-secondary p-3 overflow-x-auto text-xs`,children:t})},code:({className:e,children:t})=>e?(0,j.jsx)(`code`,{className:e,children:t}):(0,j.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-github-bg-tertiary border border-github-border text-xs font-mono`,children:t}),table:({children:e})=>(0,j.jsx)(`div`,{className:`overflow-x-auto`,children:(0,j.jsx)(`table`,{className:`min-w-full border border-github-border`,children:e})}),th:({children:e})=>(0,j.jsx)(`th`,{className:`border border-github-border px-2 py-1 bg-github-bg-tertiary text-sm`,children:e}),td:({children:e})=>(0,j.jsx)(`td`,{className:`border border-github-border px-2 py-1 text-sm`,children:e})}),Vy=e=>{let t=Oy(e.sourceLines,[`context`,`delete`]),n=Oy(e.sourceLines,[`context`,`add`]),r=[];return e.status===`change`?(t.trim()&&r.push({label:`Before`,content:t,tone:`before`}),n.trim()&&r.push({label:`After`,content:n,tone:`after`}),r.length===0&&r.push({label:`After`,content:n,tone:`after`}),r):e.status===`delete`?(r.push({label:`Before`,content:t||n,tone:`before`}),r):(r.push({label:`After`,content:n||t,tone:`after`}),r)},Hy=(e,t,n,r)=>{if(!t.trim())return(0,j.jsx)(`span`,{className:`text-xs text-github-text-muted`,children:`Empty cell`});if(e===`markdown`){let e=By(n);return(0,j.jsx)(zm,{remarkPlugins:[U_],urlTransform:e=>zy(e)?e:``,components:e,children:t})}return e===`raw`?(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap break-words text-xs font-mono text-github-text-primary`,children:t}):(0,j.jsx)(`pre`,{className:`overflow-x-auto text-xs`,children:(0,j.jsx)(Xn,{code:t.replace(/\n$/,``),language:r||`python`,syntaxTheme:n,className:`font-mono text-github-text-primary [&_.token-line]:block [&_.token-line]:whitespace-pre`})})},Uy=({lines:e,syntaxTheme:t,language:n})=>e.length===0?(0,j.jsx)(`span`,{className:`text-xs text-github-text-muted`,children:`Empty cell`}):(0,j.jsx)(`div`,{className:`overflow-x-auto`,children:(0,j.jsx)(`div`,{className:`font-mono text-xs`,children:e.map((e,r)=>(0,j.jsxs)(`div`,{className:`flex items-start min-h-[16px] ${Iy(e.type)}`,children:[(0,j.jsx)(`span`,{className:`w-5 text-center flex-shrink-0 select-none ${Ry(e.type)}`,children:Ly(e.type)}),(0,j.jsx)(Xn,{code:e.content||` `,language:n||`python`,syntaxTheme:t,className:`flex-1 px-3 text-github-text-primary whitespace-pre-wrap break-all overflow-wrap-break-word select-text [&_pre]:m-0 [&_pre]:p-0 [&_pre]:!bg-transparent [&_pre]:font-inherit [&_pre]:text-inherit [&_pre]:leading-inherit [&_code]:!bg-transparent [&_code]:font-inherit [&_code]:text-inherit [&_code]:leading-inherit`})]},`notebook-code-line-${r}`))})}),Wy=({cells:e,syntaxTheme:t,language:n})=>(0,j.jsx)(`div`,{className:`space-y-4`,children:e.map((e,r)=>{let i=Vy(e),a=e.cellType===`code`&&e.executionCount!==void 0?`In[${e.executionCount??` `}]`:null,o=e.cellType===`code`,s=o?Ay(Oy(e.sourceLines,[`context`,`delete`]),Oy(e.sourceLines,[`context`,`add`])).filter(e=>e.type!==`context`):[];return o&&s.length===0?null:(0,j.jsxs)(`div`,{className:`rounded border border-github-border bg-github-bg-secondary/40 p-4 ${Py(e.status)}`,children:[(0,j.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 mb-3`,children:(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-github-text-muted`,children:ay[e.cellType]}),a&&(0,j.jsx)(`span`,{className:`text-xs font-mono text-github-text-secondary`,children:a}),e.id&&(0,j.jsx)(`span`,{className:`text-xs font-mono text-github-text-muted`,children:e.id})]})}),(0,j.jsx)(`div`,{className:`space-y-3`,children:o?(0,j.jsx)(`div`,{className:`px-4 py-3 ${Fy(e.status===`delete`?`before`:`after`)}`,children:(0,j.jsx)(Uy,{lines:s,syntaxTheme:t,language:n})}):i.map((i,a)=>(0,j.jsx)(`div`,{className:`px-4 py-3 ${Fy(i.tone)}`,children:(0,j.jsx)(`div`,{className:`text-sm text-github-text-primary`,children:Hy(e.cellType,i.content,t,n)})},`notebook-cell-${r}-section-${a}`))})]},`notebook-cell-${r}`)})}),Gy=({cells:e,syntaxTheme:t,language:n})=>(0,j.jsx)(`div`,{className:`space-y-4`,children:e.map((e,r)=>{let i=e.cellType===`code`&&e.executionCount!==void 0?`In[${e.executionCount??` `}]`:null;return(0,j.jsxs)(`div`,{className:`rounded border border-github-border bg-github-bg-secondary/40 p-4`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-3`,children:[(0,j.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-github-text-muted`,children:ay[e.cellType]}),i&&(0,j.jsx)(`span`,{className:`text-xs font-mono text-github-text-secondary`,children:i}),e.id&&(0,j.jsx)(`span`,{className:`text-xs font-mono text-github-text-muted`,children:e.id})]}),(0,j.jsx)(`div`,{className:`text-sm text-github-text-primary`,children:Hy(e.cellType,e.sourceText,t,n)})]},`notebook-full-cell-${r}`)})});function Ky(e){let{file:t,baseCommitish:n,targetCommitish:r}=e,[i,a]=(0,A.useState)(`diff`),o=(0,A.useMemo)(()=>gy(e.mergedChunks),[e.mergedChunks]),[s,c]=(0,A.useState)({status:`idle`,cells:o.cells,language:o.language}),l=(0,A.useMemo)(()=>s.cells.filter(e=>e.status===`context`?!1:e.cellType===`code`?Ay(Oy(e.sourceLines,[`context`,`delete`]),Oy(e.sourceLines,[`context`,`add`])).filter(e=>e.type!==`context`).length>0:!0),[s.cells]),[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(o.language),[m,h]=(0,A.useState)(!1),[g,_]=(0,A.useState)(null),[v,y]=(0,A.useState)(null),b=(0,A.useMemo)(()=>!n&&!r?null:t.status===`added`?r?{path:t.path,ref:r}:null:t.status===`deleted`?n?{path:t.oldPath||t.path,ref:n}:null:r?{path:t.path,ref:r}:n?{path:t.oldPath||t.path,ref:n}:null,[n,r,t.oldPath,t.path,t.status]),x=(0,A.useMemo)(()=>b?`${b.ref}:${b.path}`:null,[b]);(0,A.useEffect)(()=>{let e=!1;return(async()=>{let i=n||`HEAD~1`,a=r||`HEAD`,s=t.oldPath||t.path,l=t.status!==`added`&&Ey(i),u=t.status!==`deleted`&&Ey(a);if(b&&x&&Ey(b?.ref)?(d(null),_(null),h(!0)):(d(null),y(null),_(null),h(!1)),!l&&!u){c({status:`ready`,cells:o.cells,language:o.language,source:`diff`,message:`Notebook content could not be loaded, falling back to diff preview.`});return}c(e=>({...e,status:`loading`}));try{let[n,r]=await Promise.all([l?Dy(s,i):Promise.resolve(null),u?Dy(t.path,a):Promise.resolve(null)]),f=n?yy(n):null,m=r?yy(r):null;if(!f&&!m){e||c({status:`ready`,cells:o.cells,language:o.language,source:`diff`,message:`Notebook content could not be parsed, falling back to diff preview.`});return}let h=m?.language??f?.language??o.language,g=Cy(f?.cells??[],m?.cells??[]),v=b?.ref===a&&b.path===t.path?m:b?.ref===i&&b.path===s?f:null;e||(c({status:`ready`,cells:g,source:`blob`,language:h}),v&&x?(d(v.cells),p(v.language??o.language),y(x),_(null)):(d(null),y(null),_(null)))}catch(t){e||(c({status:`error`,cells:o.cells,language:o.language,source:`diff`,message:t instanceof Error?t.message:`Failed to load notebook preview.`}),d(null),y(null),_(t instanceof Error?t.message:`Failed to load preview`))}finally{e||h(!1)}})(),()=>{e=!0}},[n,t.oldPath,t.path,t.status,e.mergedChunks,b,x,r,o]),(0,A.useEffect)(()=>{if(i!==`full-preview`)return;if(!b||!x||!Ey(b.ref)){d(null),y(null),_(null),h(!1);return}let e=!1;return(x!==v||!u)&&(async()=>{x!==v&&d(null),h(!0),_(null);try{let t=await Dy(b.path,b.ref);if(!t)throw Error(`Failed to load preview.`);let n=yy(t);if(!n)throw Error(`Notebook content could not be parsed.`);e||(d(n.cells),p(n.language??o.language),y(x))}catch(t){e||(d(null),y(null),_(t instanceof Error?t.message:`Failed to load preview`))}finally{e||h(!1)}})(),()=>{e=!0}},[o.language,u,v,i,b,x]);let S=(0,A.useMemo)(()=>x===v&&u!==null,[u,v,x]);return(0,A.useEffect)(()=>{i===`full-preview`&&!S&&a(`diff-preview`)},[S,i]),(0,j.jsxs)(`div`,{className:`bg-github-bg-primary`,children:[(0,j.jsx)(`div`,{className:`flex items-center justify-between border-b border-github-border px-4 py-2`,children:(0,j.jsx)(J_,{mode:i,hasFullPreview:S,onModeChange:a})}),i===`diff`&&(0,j.jsx)(Mv,{...e}),i===`diff-preview`&&(0,j.jsxs)(`div`,{className:`p-4`,children:[s.status===`loading`&&(0,j.jsx)(`div`,{className:`text-xs text-github-text-muted mb-3`,children:`Loading notebook preview…`}),s.message&&(0,j.jsx)(`div`,{className:`text-xs text-github-text-muted mb-3`,children:s.message}),l.length===0?(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`text-xs text-github-text-muted mb-3`,children:`No changed notebook cells were found. Showing raw diff instead.`}),(0,j.jsx)(Mv,{...e})]}):(0,j.jsx)(Wy,{cells:l,syntaxTheme:e.syntaxTheme,language:s.language})]}),i===`full-preview`&&(0,j.jsxs)(`div`,{className:`p-4`,children:[m&&(0,j.jsx)(`div`,{className:`text-sm text-github-text-muted mb-3`,children:`Loading preview...`}),g&&(0,j.jsx)(`div`,{className:`text-sm text-github-danger mb-3`,children:g}),!m&&!g&&u&&(0,j.jsx)(Gy,{cells:u,syntaxTheme:e.syntaxTheme,language:f??o.language}),!m&&!g&&!u&&(0,j.jsx)(`div`,{className:`text-sm text-github-text-muted`,children:`Preview unavailable.`})]})]})}var qy=[{id:`image`,match:e=>ac(e.path),Component:uc,canExpandHiddenLines:()=>!1},{id:`markdown`,match:e=>sc(e.path),Component:ry,canExpandHiddenLines:e=>e.status!==`added`&&e.status!==`deleted`},{id:`notebook`,match:e=>lc(e.path),Component:Ky,canExpandHiddenLines:e=>e.status!==`added`&&e.status!==`deleted`},{id:`default`,match:()=>!0,Component:Mv,canExpandHiddenLines:e=>e.status!==`added`&&e.status!==`deleted`}],Jy=e=>{let t=qy[qy.length-1];if(!t)throw Error(`No diff viewers registered`);return qy.find(t=>t.match(e))??t},Yy=e=>{switch(e){case`added`:return(0,j.jsx)(qe,{size:16,className:`text-github-accent`});case`deleted`:return(0,j.jsx)(Je,{size:16,className:`text-github-danger`});case`renamed`:return(0,j.jsx)(Ke,{size:16,className:`text-github-warning`});default:return(0,j.jsx)(Ge,{size:16,className:`text-github-text-secondary`})}},Xy=({file:e,isCollapsed:t,isReviewed:n,onToggleCollapsed:r,onToggleAllCollapsed:i,onToggleReviewed:a})=>{let[o,s]=(0,A.useState)(!1);return(0,j.jsxs)(`div`,{className:`bg-github-bg-secondary border-t-2 border-t-github-accent border-b border-github-border px-5 py-4 flex items-center justify-between flex-wrap gap-3 sticky top-0 z-10`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,j.jsx)(`button`,{onClick:n=>{n.altKey?i(!t):r(e.path)},className:`text-github-text-muted hover:text-github-text-primary transition-colors cursor-pointer`,title:t?`Expand file (Alt+Click to expand all)`:`Collapse file (Alt+Click to collapse all)`,children:t?(0,j.jsx)(Ie,{size:16}):(0,j.jsx)(Pe,{size:16})}),Yy(e.status),(0,j.jsx)(`h2`,{className:`text-sm font-mono text-github-text-primary m-0 overflow-hidden text-ellipsis whitespace-nowrap`,children:e.path}),(0,j.jsx)(`button`,{className:`bg-transparent border-none cursor-pointer px-1.5 py-1 rounded text-sm transition-all hover:bg-github-bg-tertiary ${o?`text-github-accent`:`text-github-text-secondary hover:text-github-text-primary`}`,onClick:()=>{Ct(e.path).then(()=>{console.log(`File path copied to clipboard:`,e.path),s(!0),setTimeout(()=>s(!1),2e3)}).catch(e=>{console.error(`Failed to copy file path:`,e)})},title:`Copy file path`,children:o?(0,j.jsx)(Ne,{size:14}):(0,j.jsx)(Ve,{size:14})}),e.oldPath&&e.oldPath!==e.path&&(0,j.jsxs)(`span`,{className:`text-xs text-github-text-muted italic`,children:[`(renamed from `,e.oldPath,`)`]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,j.jsxs)(`span`,{className:`font-medium px-1 py-0.5 rounded text-github-accent bg-green-100/10`,children:[`+`,e.additions]}),(0,j.jsxs)(`span`,{className:`font-medium px-1 py-0.5 rounded text-github-danger bg-red-100/10`,children:[`-`,e.deletions]})]}),(0,j.jsxs)(`button`,{onClick:()=>a(e.path),className:`flex items-center gap-2 px-3 py-1.5 rounded-md text-sm font-medium transition-all duration-200 ${n?`bg-github-accent text-white`:`dark:bg-slate-600 dark:text-white dark:border-slate-500 dark:hover:bg-slate-500 dark:hover:border-slate-400 bg-github-bg-secondary text-github-text-primary border border-github-border hover:bg-github-bg-tertiary hover:border-github-text-muted`}`,title:n?`Mark as not reviewed`:`Mark as reviewed`,children:[n?(0,j.jsx)(Ne,{size:14}):(0,j.jsx)(lt,{size:14}),`Viewed`]})]})]})},Zy=e=>{let t={old:[],new:[]};return e.forEach(e=>{let n=e.side??`new`,[r,i]=Array.isArray(e.line)?[e.line[0],e.line[1]]:[e.line,e.line];r<=0||i<=0||t[n].push({start:Math.min(r,i),end:Math.max(r,i)})}),t},Qy=(e,t)=>e.chunks.map((e,n)=>{let r=t===`old`?e.oldStart:e.newStart,i=t===`old`?e.oldLines:e.newLines;return!r||i<=0?null:{start:r,end:r+i-1,index:n}}).filter(e=>!!e),$y=e=>{let t=[],n=e[0];if(!n)return t;n.start>1&&t.push({type:`before`,start:1,end:n.start-1,nextChunkIndex:n.index});for(let n=1;n<e.length;n+=1){let r=e[n-1],i=e[n];!r||!i||i.start>r.end+1&&t.push({type:`between`,start:r.end+1,end:i.start-1,prevChunkIndex:r.index,nextChunkIndex:i.index})}let r=e[e.length-1];return r&&t.push({type:`after`,start:r.end+1,end:1/0,prevChunkIndex:r.index}),t},eb=e=>{let t=new Map;return e.forEach(e=>{let n=e.originalIndices[0];n!==void 0&&t.set(n,e)}),t},tb=e=>{let t=e[e.length-1];return t?.originalIndices[t.originalIndices.length-1]??null},nb=(0,A.memo)(function({file:e,threads:t,showAuthorBadges:n=!1,diffMode:r,reviewedFiles:i,onToggleReviewed:a,collapsedFiles:o,onToggleCollapsed:s,onToggleAllCollapsed:c,onAddComment:l,onGenerateThreadPrompt:u,onRemoveThread:d,onReplyToThread:f,onRemoveMessage:p,onUpdateMessage:m,onOpenInEditor:h,syntaxTheme:g,baseCommitish:_,targetCommitish:v,cursor:y=null,fileIndex:b=0,onLineClick:x,commentTrigger:S,onCommentTriggerHandled:C,mergedChunks:w,expandLines:T,expandAllBetweenChunks:E,prefetchFileContent:D,isExpandLoading:O}){let k=o.has(e.path),M=(0,A.useRef)(null),[N,P]=(0,A.useState)(!1),ee=Jy(e),F=ee.canExpandHiddenLines?.(e)??!1;(0,A.useEffect)(()=>{if(!F)return;let e=M.current;if(!e)return;let t=new IntersectionObserver(([e])=>{e?.isIntersecting&&P(!0)},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[F]),(0,A.useEffect)(()=>{N&&!k&&F&&D(e)},[N,k,F,e,D]);let I=(0,A.useCallback)(async(t,n,r,i)=>{try{await l(e.path,t,n,r,i)}catch(e){console.error(`Failed to add comment:`,e)}},[e.path,l]);(0,A.useEffect)(()=>{if(k||O||!F||t.length===0||e.chunks.length===0||w.length===0)return;let n=Zy(t),r=eb(w),i=tb(w),a=w[w.length-1],o=new Set,s=(e,t)=>{o.has(e)||(o.add(e),t())};[`old`,`new`].forEach(t=>{let o=n[t];o.length!==0&&$y(Qy(e,t)).forEach(t=>{if(!o.some(e=>e.start<=t.end&&e.end>=t.start))return;if(t.type===`after`&&a&&i!==null){a.hiddenLinesAfter>0&&s(`after-${i}`,()=>{T(e,i,`down`,a.hiddenLinesAfter)});return}let n=t.nextChunkIndex;if(n===void 0)return;let c=r.get(n);!c||c.hiddenLinesBefore<=0||(t.type===`before`?s(`before-${n}`,()=>{T(e,n,`up`,c.hiddenLinesBefore)}):t.type===`between`&&s(`between-${n}`,()=>{E(e,n,c.hiddenLinesBefore)}))})})},[t,E,T,e,k,O,w,F]);let te=ee.Component,ne={file:e,threads:t,showAuthorBadges:n,diffMode:r,syntaxTheme:g,baseCommitish:_,targetCommitish:v,cursor:y,fileIndex:b,mergedChunks:w,isExpandLoading:O,expandHiddenLines:T,expandAllBetweenChunks:E,onAddComment:I,onGenerateThreadPrompt:u,onRemoveThread:d,onReplyToThread:f,onRemoveMessage:p,onUpdateMessage:m,onOpenInEditor:h,onLineClick:x,commentTrigger:S,onCommentTriggerHandled:C};return(0,j.jsxs)(`div`,{ref:M,className:`bg-github-bg-primary`,style:{"--line-number-width":`4em`},children:[(0,j.jsx)(Xy,{file:e,isCollapsed:k,isReviewed:i.has(e.path),onToggleCollapsed:s,onToggleAllCollapsed:c,onToggleReviewed:a}),!k&&(0,j.jsx)(`div`,{className:`overflow-y-auto`,children:(0,j.jsx)(te,{...ne})})]})});function rb(e){if(!e)return!1;let t=e.toLowerCase();return t.includes(`safari`)&&!t.includes(`chrome`)&&!t.includes(`chromium`)&&!t.includes(`crios`)&&!t.includes(`fxios`)&&!t.includes(`edg/`)&&!t.includes(`android`)}var ib=16,ab=24;function ob(e){return`${e*ab+ib}px`}function sb(e){if(!e.isDirectory||!e.children)return[];let t=[];return e.path&&t.push(e.path),e.children.forEach(e=>{t.push(...sb(e))}),t}function cb(e,t){let n=new Set,r=e=>{if(e.file)return t.has(e.file.path);if(!e.isDirectory||!e.children||e.children.length===0)return!1;let i=e.children.map(e=>r(e)).every(Boolean);return i&&e.path&&n.add(e.path),i};return r(e),n}function lb(e){let t={name:``,path:``,isDirectory:!0,children:[]};e.forEach(e=>{let n=e.path.split(`/`),r=t;for(let t=0;t<n.length;t++){let i=n[t];if(!i)continue;let a=t===n.length-1,o=n.slice(0,t+1).join(`/`);r.children||=[];let s=r.children.find(e=>e.name===i);s||(s={name:i,path:o,isDirectory:!a,children:a?void 0:[],file:a?e:void 0},r.children.push(s)),r=s}});let n=e=>{if(!e.isDirectory||!e.children)return e;if(e.children=e.children.map(n),e.children.length===1&&e.children[0]?.isDirectory&&e.children[0]?.children){let t=e.children[0];if(t)return e.name?{...e,name:`${e.name}/${t.name}`,path:t.path,children:t.children}:e}return e};return n(t)}var ub=(0,A.memo)(function({files:e,onScrollToFile:t,onFileSelected:n,comments:r,reviewedFiles:i,onToggleReviewed:a,selectedFileIndex:o}){let s=(0,A.useMemo)(()=>lb(e),[e]),c=(0,A.useMemo)(()=>!rb(typeof navigator>`u`?``:navigator.userAgent),[]),l=(0,A.useRef)(null),u=(0,A.useRef)(new Map),d={"--dir-row-height":`calc(var(--spacing, 0.25rem) * 9)`},[f,p]=(0,A.useState)(()=>new Set(sb(s))),[m,h]=(0,A.useState)(``),g=(0,A.useMemo)(()=>{let e=new Map;return r.forEach(t=>{e.set(t.file,(e.get(t.file)??0)+1)}),e},[r]),_=(0,A.useMemo)(()=>{let t=new Map;return e.forEach((e,n)=>{t.set(e.path,n)}),t},[e]),v=(0,A.useMemo)(()=>cb(s,i),[s,i]),y=(0,A.useMemo)(()=>{let e=m.trim().toLowerCase(),t=n=>{if(!e)return n;if(n.isDirectory&&n.children){let e=n.children.map(e=>t(e)).filter(e=>e!==null);return e.length>0?{...n,children:e}:null}else if(n.file)return n.file.path.toLowerCase().includes(e)?n:null;return null};return t(s)||{...s,children:[]}},[s,m]),b=e=>{switch(e){case`added`:return(0,j.jsx)(qe,{size:16,className:`text-github-accent`});case`deleted`:return(0,j.jsx)(Je,{size:16,className:`text-github-danger`});case`renamed`:return(0,j.jsx)(Ke,{size:16,className:`text-github-warning`});default:return(0,j.jsx)(Ge,{size:16,className:`text-github-text-secondary`})}},x=e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},S=(0,A.useMemo)(()=>sb(s),[s]),C=f.size===S.length&&S.length>0,w=()=>{p(C?new Set:new Set(S))},T=(e,t)=>{if(!c){x(t);return}let n=l.current,r=e.currentTarget;if(!n){x(t);return}let i=n.getBoundingClientRect(),a=r.getBoundingClientRect(),o=Number.parseFloat(getComputedStyle(r).top||`0`);if(a.top-i.top<=o+1){let e=u.current.get(t)?.querySelector(`[data-tree-row="true"]:not([data-dir-header="true"])`),i=r.getBoundingClientRect().height||0,a=e??r,o=i*Number.parseInt(a.dataset.depth||r.dataset.depth||`0`,10),s=Math.max(0,a.offsetTop-o);if(Math.abs(n.scrollTop-s)<=1){x(t);return}n.scrollTo({top:s,behavior:`smooth`});return}x(t)},E=(e,r=0)=>{if(e.isDirectory&&e.children){let t=f.has(e.path),n=v.has(e.path);return(0,j.jsxs)(`div`,{"data-dir-container":e.path||void 0,ref:t=>{e.path&&(t?u.current.set(e.path,t):u.current.delete(e.path))},children:[e.name&&(0,j.jsxs)(`div`,{className:`${c?`sticky `:``}flex h-9 items-center gap-2 bg-github-bg-secondary px-4 hover:bg-github-bg-tertiary cursor-pointer ${n?`opacity-70`:``}`,"data-dir-header":`true`,"data-tree-row":`true`,"data-depth":r,style:{paddingLeft:ob(r),top:c?`calc(${r} * var(--dir-row-height))`:void 0,zIndex:c?1e3-r:void 0},onClick:t=>T(t,e.path),children:[t?(0,j.jsx)(Pe,{size:16}):(0,j.jsx)(Ie,{size:16}),t?(0,j.jsx)(Ye,{size:16,className:`text-github-text-secondary`}):(0,j.jsx)(Xe,{size:16,className:`text-github-text-secondary`}),(0,j.jsx)(`span`,{className:`text-sm text-github-text-primary font-medium flex-1 overflow-hidden text-ellipsis whitespace-nowrap ${n?`line-through text-github-text-muted`:``}`,title:e.name,children:e.name})]}),(t||!e.name)&&e.children.map(t=>E(t,e.name?r+1:r))]},e.path)}else if(e.file){let s=e.file,c=g.get(s.path)??0,l=i.has(s.path),u=_.get(s.path)??-1;return(0,j.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 hover:bg-github-bg-tertiary cursor-pointer transition-colors ${l?`opacity-70`:``} ${o!==null&&o===u?`bg-github-bg-tertiary`:``}`,"data-file-row":`true`,"data-tree-row":`true`,"data-depth":r,style:{paddingLeft:ob(r)},onClick:()=>{t(s.path),n?.()},children:[(0,j.jsx)(bt,{checked:l,onChange:()=>{a(s.path)},title:l?`Mark as not reviewed`:`Mark as reviewed`,className:`z-10`}),b(e.file.status),(0,j.jsx)(`span`,{className:`text-sm text-github-text-primary flex-1 overflow-hidden text-ellipsis whitespace-nowrap ${l?`line-through text-github-text-muted`:``}`,title:e.file.path,children:e.name}),c>0&&(0,j.jsxs)(`span`,{className:`text-github-warning text-sm font-medium ml-auto flex items-center gap-1`,children:[(0,j.jsx)(nt,{size:14}),c]})]},s.path)}return null};return(0,j.jsxs)(`div`,{className:`h-full flex flex-col`,children:[(0,j.jsxs)(`div`,{className:`px-4 py-3 border-b border-github-border bg-github-bg-tertiary`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,j.jsxs)(`h3`,{className:`text-sm font-semibold text-github-text-primary m-0`,children:[`Files changed (`,e.length,`)`]}),(0,j.jsx)(`button`,{onClick:w,className:`p-1 hover:bg-github-bg-primary rounded transition-colors`,title:C?`Collapse all`:`Expand all`,children:C?(0,j.jsx)(Le,{size:16,className:`text-github-text-secondary`}):(0,j.jsx)(Re,{size:16,className:`text-github-text-secondary`})})]}),(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(st,{size:16,className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-github-text-muted`}),(0,j.jsx)(`input`,{type:`text`,placeholder:`Filter files...`,value:m,onChange:e=>h(e.target.value),className:`w-full pl-9 pr-3 py-2 text-sm bg-github-bg-primary border border-github-border rounded-md focus:outline-none focus:border-github-accent text-github-text-primary placeholder-github-text-muted`})]})]}),(0,j.jsx)(`div`,{className:`flex-1 overflow-y-auto relative z-0`,style:d,ref:l,children:y.children?.map(e=>E(e))})]})});function db({style:e}){return(0,j.jsx)(`svg`,{width:`98`,height:`96`,viewBox:`0, 0, 98, 96`,style:e,xmlns:`http://www.w3.org/2000/svg`,"aria-label":`GitHub`,role:`img`,children:(0,j.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z`,fill:`currentColor`})})}function fb({isOpen:e,onClose:t}){let{enableScope:n,disableScope:r}=ge();return xe(`escape`,()=>t(),{enabled:e},[t,e]),(0,A.useEffect)(()=>(e?r(`navigation`):n(`navigation`),()=>{n(`navigation`)}),[e,n,r]),e?(0,j.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0 bg-black/50`,onClick:t}),(0,j.jsxs)(`div`,{className:`relative bg-github-bg-primary border border-github-border rounded-lg shadow-lg max-w-4xl w-full mx-4 max-h-[80vh] overflow-y-auto`,children:[(0,j.jsxs)(`div`,{className:`sticky top-0 bg-github-bg-primary border-b border-github-border px-6 py-4 flex items-center justify-between`,children:[(0,j.jsx)(`h2`,{className:`text-lg font-semibold text-github-text-primary`,children:`Keyboard Shortcuts`}),(0,j.jsx)(`button`,{onClick:t,className:`text-github-text-secondary hover:text-github-text-primary transition-colors`,"aria-label":`Close help modal`,children:(0,j.jsx)(pt,{size:20})})]}),(0,j.jsxs)(`div`,{className:`px-6 py-4 grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Line Navigation`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`j`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`↓`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Next line`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`k`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`↑`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Previous line`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`File Navigation`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`]`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Next file`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`[`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Previous file`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`[`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Jump to first file`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`]`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Jump to last file`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Chunk Navigation`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`n`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Next change chunk (added/deleted lines)`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`p`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Previous change chunk (added/deleted lines)`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Comment Navigation`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`N`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Next comment`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`P`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Previous comment`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Side Navigation (Side-by-side mode)`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`h`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`←`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Focus left side`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`l`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`→`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Focus right side`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Comment Management`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`L`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`View all comments list`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`C`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Copy all comments prompt`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`D`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Delete all comments`})]})]})]}),(0,j.jsxs)(`section`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-github-text-primary mb-2`,children:`Actions`}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`v`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Toggle viewed state of current file`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`Shift`}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`+`}),(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`R`})]}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Refresh diff when changes detected`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`c`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Add comment at current line`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`.`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Move cursor to center of viewport`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,j.jsx)(`kbd`,{className:`px-2 py-1 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary font-mono`,children:`?`}),(0,j.jsx)(`span`,{className:`text-github-text-secondary`,children:`Show/hide this help`})]})]})]}),(0,j.jsx)(`div`,{className:`pt-4 border-t border-github-border lg:col-span-2`,children:(0,j.jsx)(`p`,{className:`text-xs text-github-text-secondary`,children:`Shortcuts are disabled when typing in input fields.`})})]})]})]}):null}function pb({style:e}){return(0,j.jsxs)(`svg`,{style:e,viewBox:`0 0 720 190`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-label":`difit`,role:`img`,children:[(0,j.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M440.487 5.90627C432.164 9.01695 427.318 16.2817 427.318 25.649C427.318 35.9474 433.206 43.6458 442.714 45.7819C451.336 47.7188 459.606 44.3893 464.84 36.8737C466.923 33.8843 467.35 32.4073 467.606 27.3105C467.773 23.9957 467.492 20.0154 466.983 18.4654C465.699 14.5629 460.869 9.13088 456.854 7.07513C452.57 4.88086 444.73 4.32102 440.487 5.90627ZM596.658 6.653C588.927 9.55794 584.572 15.4908 583.887 24.0465C583.17 33.0212 586.83 39.8868 594.382 43.7278C603.739 48.4877 615.574 44.5081 620.482 34.9515C625.35 25.4728 622.15 13.4916 613.37 8.32678C608.986 5.74808 601.154 4.96365 596.658 6.653ZM368.585 7.68006C367.464 8.80629 367.302 12.903 367.302 40.2286V71.4878L363.832 68.1329C353.432 58.0787 335.595 52.668 319.246 54.6082C310.542 55.641 299.81 59.1369 293.3 63.0607C278.56 71.9427 266.453 89.5576 263.139 106.945C261.765 114.155 261.602 129.431 262.825 136.365C265.723 152.796 274.795 168.36 286.716 177.355C298.275 186.077 310.237 190 325.274 190C340.687 190 353.943 185.273 362.869 176.594L367.302 172.284V178.215C367.302 186.902 366.946 186.724 384.303 186.709C392.243 186.702 399.29 186.347 399.964 185.919C401.04 185.236 401.189 174.47 401.189 97.1224C401.189 23.7236 401.003 8.87842 400.068 7.74809C398.433 5.77021 370.547 5.71037 368.585 7.68006ZM526.937 7.94153C519.783 10.0325 515.359 12.5834 510.029 17.6867C501.959 25.4129 498.766 34.4597 498.766 49.5975V58.8517H490.659C484.378 58.8517 482.263 59.1418 481.268 60.1394C480.214 61.1976 479.986 63.6558 479.986 73.91C479.986 82.5264 480.289 86.6977 480.966 87.3764C481.601 88.0141 484.903 88.36 490.356 88.36H498.766V136.692C498.766 183.638 498.811 185.048 500.345 185.873C502.433 186.994 529.394 186.994 531.482 185.873C533.016 185.048 533.061 183.638 533.061 136.692V88.36H549.334C563.038 88.36 565.809 88.1568 566.89 87.0723C568.782 85.1723 568.782 62.0394 566.89 60.1394C565.808 59.0541 563.029 58.8517 549.231 58.8517H532.856L533.216 51.9721C533.604 44.5499 534.721 41.9147 538.546 39.3958C540.377 38.1901 543.049 37.904 554.661 37.6737C562.626 37.5155 569.018 37.0343 569.602 36.5483C570.892 35.4761 571.046 10.3579 569.777 7.9776C568.978 6.47923 567.918 6.39562 550.384 6.45054C535.269 6.49808 530.93 6.77431 526.937 7.94153ZM654.931 26.4834C653.136 27.7662 653.094 28.1572 653.094 43.3245V58.8517H644.567C633.342 58.8517 633.497 58.6443 633.497 73.6059C633.497 88.5674 633.342 88.36 644.567 88.36H653.094V122.636C653.094 159.998 653.439 163.935 657.362 171.354C661.848 179.838 669.111 184.99 680.857 188.022C687.996 189.866 707.647 189.269 714.309 187.007C719.756 185.158 719.86 184.87 719.969 171.298C720.082 157.364 720.441 157.791 709.174 158.48C695.386 159.324 689.341 156.938 687.388 149.883C686.927 148.214 686.58 134.435 686.577 117.663L686.572 88.36H702.068H717.564L718.87 86.3592C719.946 84.7108 720.129 82.3461 719.91 72.9575C719.719 64.8279 719.321 61.1689 718.522 60.2041C717.553 59.0345 715.315 58.8517 701.987 58.8517H686.572L686.546 43.8926C686.526 31.8556 686.28 28.613 685.288 27.2941C684.156 25.7884 682.945 25.6351 670.412 25.4129C658.94 25.2088 656.476 25.3793 654.931 26.4834ZM431.459 60.1394C430.316 61.2877 430.178 68.0001 430.188 121.82C430.197 168.838 430.429 182.667 431.232 184.262L432.264 186.311L446.657 186.535C458.941 186.725 461.242 186.567 462.353 185.452C463.521 184.279 463.655 177.845 463.655 122.786C463.655 68.0985 463.515 61.2877 462.372 60.1394C460.469 58.2287 433.362 58.2287 431.459 60.1394ZM587.799 60.4369C587.238 61.4894 586.954 82.56 586.954 123.084C586.954 177.502 587.093 184.285 588.236 185.434C590.138 187.342 616.431 187.342 618.333 185.434C619.476 184.285 619.615 177.447 619.615 122.482C619.615 75.6149 619.38 60.5828 618.636 59.8353C617.947 59.1443 613.344 58.8517 603.15 58.8517C589.644 58.8517 588.586 58.9607 587.799 60.4369ZM347.956 87.3469C362.023 93.9543 369.138 107.306 367.775 124.535C366.623 139.097 359.678 149.866 347.83 155.463C337.073 160.544 325.541 160.523 315.049 155.403C293.381 144.83 288.765 112.315 306.417 94.5961C313.92 87.0641 322.021 84.1412 334.301 84.5354C341.49 84.7666 343.224 85.124 347.956 87.3469Z`,fill:`currentColor`}),(0,j.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9.42299 0.744751C4.61699 2.15275 2.03999 5.66375 0.956994 12.2768C-0.369006 20.3728 -0.294006 170.791 1.03899 176.572C2.29699 182.031 4.81699 185.308 9.65399 187.774C13.265 189.615 16.865 189.684 108.63 189.684C163.129 189.684 204.095 189.304 204.41 188.795C206 188.5 206 188.795 207.5 188C211.167 187.079 216.779 180.138 218.005 175.584C218.682 173.068 218.939 143.952 218.756 90.4718C218.487 11.7478 218.417 9.10275 216.535 6.62675C215.466 5.22075 213.441 3.19575 212.035 2.12675C209.546 0.23575 206.839 0.17975 110.978 0.0167504C55.373 -0.0782496 11.148 0.239751 9.42299 0.744751ZM203.778 14.8838C205.558 16.6638 205.509 172.577 203.728 175.005C202.577 176.574 198.865 176.688 156.978 176.446L111.478 176.184L111.226 138.684L110.974 101.184H84.059C69.255 101.184 56.808 101.52 56.397 101.931C55.986 102.343 60.674 107.82 66.814 114.104C72.954 120.388 77.978 126.202 77.978 127.026C77.978 129.577 74.769 134.267 71.896 135.916C69.609 137.229 68.75 137.278 66.704 136.217C63.533 134.572 28.705 99.1448 27.757 96.5998C27.36 95.5348 27.491 93.4308 28.049 91.9238C28.955 89.4768 68.498 49.6838 70.024 49.6838C70.366 49.6838 72.356 51.1627 74.447 52.9697C77.589 55.6867 78.118 56.6658 77.498 58.6198C77.086 59.9198 72.075 65.8308 66.363 71.7568C60.651 77.6818 55.978 83.0148 55.978 83.6068C55.978 84.3488 64.068 84.6838 81.952 84.6838H107.927H110.666C111.144 82.5 110.978 73.4537 110.978 46.2337V13.6838H156.778C191.067 13.6838 202.88 13.9858 203.778 14.8838ZM148.803 52.7217C146.51 54.0597 144.845 59.5997 145.74 62.9107C146.146 64.4107 150.657 69.9308 155.764 75.1788C161.411 80.9788 164.547 84.8988 163.764 85.1788C163.057 85.4318 151.549 85.7608 138.19 85.9108C117.896 86.1388 113.747 86.4308 112.956 87.6838C112.435 88.5088 112.002 91.7228 111.993 94.8268C111.982 99.0598 112.373 100.622 113.56 101.077C114.43 101.411 126.13 101.684 139.56 101.684C156.121 101.684 163.978 102.026 163.978 102.746C163.978 103.33 160.187 107.607 155.554 112.251C146.244 121.582 144.276 125.371 146.069 130.514C147.321 134.107 149.576 135.684 153.463 135.684C155.522 135.684 159.843 131.902 173.778 117.904C191.699 99.9008 194.978 96.0678 194.978 93.1208C194.978 91.1338 157.422 53.8238 154.163 52.5728C151.322 51.4818 150.908 51.4937 148.803 52.7217Z`,fill:`currentColor`})]})}function mb({shouldReload:e,isReloading:t,onReload:n,changeType:r,className:i=``,compact:a=!1}){return e?(0,j.jsxs)(`button`,{onClick:n,disabled:t,className:`
63
63
  flex items-center gap-1.5 text-xs rounded-md border ${i} ${a?`px-2 py-2`:`px-3 py-1.5`}
64
64
  ${t?`bg-github-text-primary text-github-bg-primary border-github-text-primary cursor-not-allowed`:`bg-github-text-primary text-github-bg-primary border-github-text-primary`}
65
- `,title:`${(()=>{switch(r){case`commit`:return`New commits available`;case`staging`:return`Staging changes detected`;case`file`:return`File changes detected`;default:return`Changes detected`}})()} - Click to refresh`,"aria-label":a?`Refresh`:void 0,children:[(0,j.jsx)(ot,{size:12,className:`${t?`animate-spin`:``}`}),a?(0,j.jsx)(`span`,{className:`sr-only`,children:`Refresh`}):`Refresh`]}):null}var pb=new Set([`merge-base`]);function mb({label:e,value:t,resolvedValue:n,onChange:r,options:i,disabledValues:a=[]}){let[o,s]=(0,A.useState)(!1),{refs:c,floatingStyles:l,context:u}=Ps({open:o,onOpenChange:s,middleware:[_o(4),yo(),vo({padding:8})],whileElementsMounted:oo}),{getReferenceProps:d,getFloatingProps:f}=Rs([Go(u,{handleClose:Ys()}),Os(u),Is(u),Ms(u),Bs(u)]),p=t===`working`&&a.includes(`staged`)||t===`staged`&&a.includes(`working`),m=i.specialOptions.filter(e=>!pb.has(e.value)),h=()=>{let e=m.find(e=>e.value===t);if(e)return e.label;let n=i.branches.find(e=>e.name===t);if(n)return`${n.name}${n.current?` (current)`:``}`;let r=i.commits.find(e=>e.shortHash===t||e.hash===t);return r?`${r.shortHash} - ${r.message}`:t||`Select...`},g=e=>{r(e),s(!1)},_=e=>a.includes(e),v=(e,t)=>[`w-full text-left px-3 py-2 text-xs focus:outline-none transition-colors`,e?`hover:bg-diff-selected-bg focus:bg-diff-selected-bg`:`hover:bg-github-bg-tertiary focus:bg-github-bg-tertiary`,e?`bg-diff-selected-bg border-l-4 border-l-diff-selected-border font-semibold pl-2`:``,t?`opacity-50 cursor-not-allowed`:`cursor-pointer`].join(` `),y=(e,r)=>e===t||r===t?!0:n?e===n||r===n:!1,b=()=>{let e=0,n=m.findIndex(e=>e.value===t);if(n!==-1)return n;if(e+=m.length,!p){let n=i.commits.findIndex(e=>e.shortHash===t);if(n!==-1)return e+n;e+=i.commits.length;let r=i.branches.findIndex(e=>e.name===t);if(r!==-1)return e+r}return 0};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`button`,{ref:c.setReference,type:`button`,className:`flex items-center gap-1.5 cursor-pointer group`,"aria-haspopup":`listbox`,"aria-expanded":o,...d(),children:[(0,j.jsxs)(`span`,{className:`text-xs text-github-text-secondary`,children:[e,`:`]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 bg-github-bg-tertiary border border-github-border rounded hover:border-github-text-secondary transition-colors`,children:[(0,j.jsx)(`code`,{className:`text-xs text-github-text-primary max-w-[150px] truncate`,children:h()}),(0,j.jsx)(Pe,{size:12,className:`text-github-text-secondary group-hover:text-github-text-primary transition-colors`})]})]}),o&&(0,j.jsx)(ps,{children:(0,j.jsx)(ws,{context:u,modal:!1,initialFocus:b(),children:(0,j.jsxs)(`div`,{ref:c.setFloating,style:l,className:`bg-github-bg-secondary border border-github-border rounded shadow-lg z-50 w-[360px] max-h-[400px] overflow-y-auto`,...f(),children:[m.length>0&&(0,j.jsxs)(`div`,{className:`border-b border-github-border`,children:[(0,j.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold text-github-text-secondary bg-github-bg-tertiary`,children:`Special`}),m.map(e=>(0,j.jsx)(`button`,{onClick:()=>g(e.value),disabled:_(e.value),className:v(e.value===t,_(e.value)),children:e.label},e.value))]}),!p&&i.commits.length>0&&(0,j.jsxs)(`div`,{className:`border-b border-github-border`,children:[(0,j.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold text-github-text-secondary bg-github-bg-tertiary`,children:`Recent Commits`}),i.commits.map(e=>(0,j.jsx)(`button`,{onClick:()=>g(e.shortHash),disabled:_(e.shortHash),className:v(y(e.shortHash,e.hash),_(e.shortHash)),children:(0,j.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,j.jsx)(`code`,{className:`text-xs text-github-text-primary font-mono whitespace-nowrap`,children:e.shortHash}),(0,j.jsx)(`span`,{className:`text-xs text-github-text-secondary flex-1 break-words`,children:e.message})]})},e.hash))]}),!p&&i.branches.length>0&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold text-github-text-secondary bg-github-bg-tertiary`,children:`Branches`}),i.branches.map(e=>(0,j.jsx)(`button`,{onClick:()=>g(e.name),disabled:_(e.name),className:v(e.name===t,_(e.name)),children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-github-text-primary`,children:e.name}),e.current&&(0,j.jsx)(`span`,{className:`text-xs text-github-text-muted`,children:`(current)`})]})},e.name))]})]})})})]})}function hb({isOpen:e,onClose:t,options:n,selection:r,resolvedBaseRevision:i,resolvedTargetRevision:a,onApply:o}){let[s,c]=(0,A.useState)(r),{enableScope:l,disableScope:u}=ge(),d=s.baseCommitish,f=s.targetCommitish;(0,A.useEffect)(()=>{c(r)},[r]),(0,A.useEffect)(()=>(e?u(`navigation`):l(`navigation`),()=>{l(`navigation`)}),[e,l,u]);let p=(0,A.useMemo)(()=>{let e=a||f,t=n.commits.findIndex(t=>t.shortHash===e||t.hash===e);if(t===-1)return f?[f]:[];let r=n.commits.slice(0,t+1).map(e=>e.shortHash);return f&&!r.includes(f)&&r.push(f),r.includes(`working`)||r.push(`working`),r},[f,a,n.commits]),m=(0,A.useMemo)(()=>{let e=i||d,t=n.commits.findIndex(t=>t.shortHash===e||t.hash===e);if(t===-1)return d?[d]:[];let r=n.commits.slice(t).map(e=>e.shortHash);return d&&!r.includes(d)&&r.push(d),r},[d,i,n.commits]);return e?(0,j.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0 bg-black/40`,onClick:t}),(0,j.jsxs)(`div`,{className:`relative bg-github-bg-secondary border border-github-border rounded-lg shadow-lg w-full max-w-lg mx-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-github-border`,children:[(0,j.jsx)(`h2`,{className:`text-lg font-semibold text-github-text-primary`,children:`Detailed Diff`}),(0,j.jsx)(`button`,{onClick:t,className:`text-github-text-secondary hover:text-github-text-primary p-1`,"aria-label":`Close detailed diff`,children:(0,j.jsx)(pt,{size:18})})]}),(0,j.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[(0,j.jsx)(mb,{label:`Base`,value:d,resolvedValue:i,onChange:e=>c(_t(e,s.targetCommitish)),options:n,disabledValues:p}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`...`}),(0,j.jsx)(mb,{label:`Target`,value:f,resolvedValue:a,onChange:e=>c(_t(s.baseCommitish,e)),options:n,disabledValues:m})]}),(0,j.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,j.jsx)(`button`,{onClick:t,className:`px-3 py-1.5 text-xs font-medium rounded border border-github-border text-github-text-secondary hover:text-github-text-primary transition-colors`,type:`button`,children:`Cancel`}),(0,j.jsx)(`button`,{onClick:()=>{o(_t(s.baseCommitish,s.targetCommitish)),t()},className:`px-3 py-1.5 text-xs font-medium rounded bg-github-accent text-white hover:bg-github-accent/90 transition-colors`,type:`button`,children:`Apply`})]})]})]})]}):null}var gb=[{id:`vscode`,label:`VS Code`,protocol:`vscode`,cliCommand:`code`,cliArgs:[],lineFormat:`goto-flag`,aliases:[`vscode`,`code`]},{id:`cursor`,label:`Cursor`,protocol:`cursor`,cliCommand:`cursor`,cliArgs:[],lineFormat:`goto-flag`,aliases:[`cursor`]},{id:`zed`,label:`Zed`,protocol:`zed`,cliCommand:`zed`,cliArgs:[],lineFormat:`path-suffix`,aliases:[`zed`]},{id:`none`,label:`Hide “Open in editor” button`,protocol:null,cliCommand:null,cliArgs:[],lineFormat:`goto-flag`,aliases:[`none`,`disabled`,`off`]}],_b=`vscode`;function vb(e){return e.replaceAll(`\\`,`/`).replace(/^\.\/+/,``)}function yb(e){return e.replace(/[|\\{}()[\]^$+?.]/g,`\\$&`)}function bb(e){let t=new Set;return e.forEach(e=>{let n=e.trim();n&&t.add(vb(n))}),[...t]}function xb(e){return vb(e).split(`/`).filter(e=>e.length>0)}function Sb(e,t){let n=`^`;for(let e of t){if(e===`*`){n+=`.*`;continue}if(e===`?`){n+=`.`;continue}n+=yb(e)}return n+=`$`,new RegExp(n).test(e)}function Cb(e,t,n=0,r=0){if(r>=t.length)return n>=e.length;let i=t[r];if(!i)return n>=e.length;if(i===`**`){let i=r+1;if(i>=t.length)return!0;for(let r=n;r<=e.length;r+=1)if(Cb(e,t,r,i))return!0;return!1}let a=e[n];return!a||!Sb(a,i)?!1:Cb(e,t,n+1,r+1)}function wb(e){return Array.isArray(e)?bb(e.filter(e=>typeof e==`string`)):[]}function Tb(e){return bb(e.split(/\r?\n/))}function Eb(e){return wb(e).join(`
66
- `)}function Db(e,t){let n=vb(t.trim());if(!n)return!1;let r=vb(e);return n.includes(`/`)?Cb(xb(r),xb(n)):Sb(r.split(`/`).pop()??r,n)}function Ob(e,t){return wb(t).some(t=>Db(e,t))}var kb=[{id:`github`,label:`GitHub Light`},{id:`vsLight`,label:`VS Light`},{id:`oneLight`,label:`One Light`},{id:`gruvboxMaterialLight`,label:`Gruvbox Material Light`},{id:`nightOwlLight`,label:`Night Owl Light`}],Ab=[{id:`vsDark`,label:`VS Dark`},{id:`oneDark`,label:`One Dark`},{id:`gruvboxMaterialDark`,label:`Gruvbox Material Dark`},{id:`nightOwl`,label:`Night Owl`},{id:`dracula`,label:`Dracula`},{id:`okaidia`,label:`Okaidia`}],jb=e=>e===`light`?kb:Ab,Mb=(e,t)=>jb(t).some(t=>t.id===e),Nb=e=>jb(e)[0],Pb=e=>e===`top`?`translateY(4px)`:e===`bottom`?`translateY(-4px)`:e===`left`?`translateX(4px)`:`translateX(-4px)`,Fb=(e,t)=>{if(typeof e==`function`){e(t);return}e&&`current`in e&&(e.current=t)};function Ib({content:e,children:t,placement:n=`top`,className:r=``}){let[i,a]=(0,A.useState)(!1),o=(0,A.useId)(),{refs:s,floatingStyles:c,context:l}=Ps({open:i,onOpenChange:a,placement:n,middleware:[_o(8),yo(),vo({padding:8})],whileElementsMounted:oo}),u=Go(l,{move:!1}),d=Is(l),f=Ms(l),p=Bs(l,{role:`tooltip`}),{isMounted:m,styles:h}=Gs(l,{duration:{open:180,close:120},initial:({side:e})=>({opacity:0,transform:Pb(e)}),open:{opacity:1,transform:`translate(0, 0)`},close:({side:e})=>({opacity:0,transform:Pb(e)}),common:{willChange:`opacity, transform`}}),{getReferenceProps:g,getFloatingProps:_}=Rs([u,d,f,p]),v=t.props,y=g({...v,"aria-describedby":i?o:void 0}),b=[`w-64 rounded-md border border-github-border bg-github-bg-primary px-3 py-2 text-xs text-github-text-primary`,r].filter(Boolean).join(` `);return(0,j.jsxs)(j.Fragment,{children:[(0,A.cloneElement)(t,{...y,ref:e=>{Fb(v.ref,e),s.setReference(e)}}),m?(0,j.jsx)(ps,{children:(0,j.jsx)(`div`,{ref:s.setFloating,..._(),id:o,style:c,className:`z-[60]`,children:(0,j.jsx)(`div`,{style:h,className:b,children:e})})}):null]})}var Lb={fontSize:14,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif`,theme:`dark`,syntaxTheme:`vsDark`,editor:_b,colorVision:`normal`,autoViewedPatterns:[]},Rb=[{name:`System Font`,value:`-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif`},{name:`Menlo`,value:`Menlo, Monaco, "Courier New", monospace`},{name:`SF Mono`,value:`SF Mono, Consolas, "Liberation Mono", monospace`},{name:`Fira Code`,value:`"Fira Code", "Courier New", monospace`},{name:`JetBrains Mono`,value:`"JetBrains Mono", "Courier New", monospace`}],zb=[{id:`normal`,label:`Normal`},{id:`deuteranopia`,label:`Deuteranopia`,tooltip:`Deuteranopia mode uses blue/orange instead of green/red for diffs.`}],Bb=[{id:`appearance`,label:`Appearance`},{id:`system`,label:`System`}];function Vb({isOpen:e,onClose:t,settings:n,onSettingsChange:r}){let[i,a]=(0,A.useState)(Eb(n.autoViewedPatterns)),[o,s]=(0,A.useState)(`appearance`),{enableScope:c,disableScope:l}=ge();(0,A.useEffect)(()=>(e?l(`navigation`):c(`navigation`),()=>{c(`navigation`)}),[e,c,l]);let u=()=>n.theme===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:n.theme,d=()=>jb(u()),f=e=>{let t={...n,theme:e},i=e===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e;if(!Mb(n.syntaxTheme,i)){let e=Nb(i);e&&(t.syntaxTheme=e.id)}r(t)};return e?(0,j.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center z-50 pointer-events-none`,children:(0,j.jsxs)(`div`,{className:`bg-github-bg-secondary border border-github-border rounded-lg w-full max-w-3xl mx-4 pointer-events-auto overflow-hidden`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-github-border`,children:[(0,j.jsxs)(`h2`,{className:`text-lg font-semibold text-github-text-primary flex items-center gap-2`,children:[(0,j.jsx)(ct,{size:20}),`Settings`]}),(0,j.jsx)(`button`,{onClick:t,className:`text-github-text-secondary hover:text-github-text-primary p-1`,children:(0,j.jsx)(pt,{size:18})})]}),(0,j.jsxs)(`div`,{className:`flex flex-col sm:flex-row min-h-[420px]`,children:[(0,j.jsx)(`nav`,{"aria-label":`Settings sections`,className:`sm:w-40 border-b sm:border-b-0 sm:border-r border-github-border px-3 py-2`,children:(0,j.jsx)(`div`,{className:`flex sm:flex-col gap-1`,children:Bb.map(e=>{let t=e.id===o;return(0,j.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),"aria-pressed":t,className:`flex-1 sm:flex-none text-left px-3 py-2 text-sm font-medium transition-colors border-b-2 sm:border-b-0 sm:border-l-2 ${t?`text-github-text-primary border-github-accent`:`text-github-text-secondary border-transparent hover:text-github-text-primary`}`,children:e.label},e.id)})})}),(0,j.jsxs)(`div`,{className:`flex-1 p-4 sm:p-6 overflow-y-auto`,children:[o===`appearance`&&(0,j.jsxs)(`div`,{className:`space-y-6`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Font Size`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(`input`,{type:`range`,min:`10`,max:`20`,step:`1`,value:n.fontSize,onChange:e=>r({...n,fontSize:Number.parseInt(e.target.value,10)}),className:`flex-1 accent-github-accent`}),(0,j.jsxs)(`span`,{className:`text-sm text-github-text-secondary w-8 text-right`,children:[n.fontSize,`px`]})]})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Font Family`}),(0,j.jsx)(`select`,{value:n.fontFamily,onChange:e=>r({...n,fontFamily:e.target.value}),className:`w-full p-2 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary text-sm`,children:Rb.map(e=>(0,j.jsx)(`option`,{value:e.value,children:e.name},e.value))})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Theme`}),(0,j.jsx)(`div`,{className:`flex gap-2`,children:[`light`,`dark`,`auto`].map(e=>(0,j.jsx)(`button`,{type:`button`,onClick:()=>f(e),className:`px-3 py-2 text-sm rounded border transition-colors ${n.theme===e?`bg-github-accent text-white border-github-accent`:`bg-github-bg-tertiary text-github-text-secondary border-github-border hover:text-github-text-primary`}`,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Color Vision`}),(0,j.jsx)(`div`,{className:`flex gap-2`,children:zb.map(e=>{let t=(0,j.jsx)(`button`,{type:`button`,onClick:()=>r({...n,colorVision:e.id}),className:`px-3 py-2 text-sm rounded border transition-colors ${(n.colorVision??`normal`)===e.id?`bg-github-accent text-white border-github-accent`:`bg-github-bg-tertiary text-github-text-secondary border-github-border hover:text-github-text-primary`}`,children:e.label},e.id);return`tooltip`in e?(0,j.jsx)(Ib,{content:e.tooltip,children:t},e.id):t})})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Syntax Highlighting Theme`}),(0,j.jsx)(`select`,{value:n.syntaxTheme,onChange:e=>r({...n,syntaxTheme:e.target.value}),className:`w-full p-2 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary text-sm`,children:d().map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.label},e.id))})]})]}),o===`system`&&(0,j.jsxs)(`div`,{className:`space-y-6`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Open In Editor`}),(0,j.jsx)(`select`,{value:n.editor,onChange:e=>r({...n,editor:e.target.value}),className:`w-full p-2 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary text-sm`,children:gb.map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:`auto-viewed-patterns`,className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Auto-Mark Viewed Patterns`}),(0,j.jsx)(`p`,{className:`text-sm text-github-text-secondary mb-2`,children:`Files matching these glob patterns are marked as Viewed automatically. Enter one pattern per line.`}),(0,j.jsx)(`textarea`,{id:`auto-viewed-patterns`,value:i,onChange:e=>{a(e.target.value),r({...n,autoViewedPatterns:Tb(e.target.value)})},rows:6,spellCheck:!1,placeholder:`*.test.ts
65
+ `,title:`${(()=>{switch(r){case`commit`:return`New commits available`;case`staging`:return`Staging changes detected`;case`file`:return`File changes detected`;default:return`Changes detected`}})()} - Click to refresh`,"aria-label":a?`Refresh`:void 0,children:[(0,j.jsx)(ot,{size:12,className:`${t?`animate-spin`:``}`}),a?(0,j.jsx)(`span`,{className:`sr-only`,children:`Refresh`}):`Refresh`]}):null}var hb=new Set([`merge-base`]);function gb({label:e,value:t,resolvedValue:n,onChange:r,options:i,disabledValues:a=[]}){let[o,s]=(0,A.useState)(!1),{refs:c,floatingStyles:l,context:u}=Ps({open:o,onOpenChange:s,middleware:[_o(4),yo(),vo({padding:8})],whileElementsMounted:oo}),{getReferenceProps:d,getFloatingProps:f}=Rs([Go(u,{handleClose:Ys()}),Os(u),Is(u),Ms(u),Bs(u)]),p=t===`working`&&a.includes(`staged`)||t===`staged`&&a.includes(`working`),m=i.specialOptions.filter(e=>!hb.has(e.value)),h=()=>{let e=m.find(e=>e.value===t);if(e)return e.label;let n=i.branches.find(e=>e.name===t);if(n)return`${n.name}${n.current?` (current)`:``}`;let r=i.commits.find(e=>e.shortHash===t||e.hash===t);return r?`${r.shortHash} - ${r.message}`:t||`Select...`},g=e=>{r(e),s(!1)},_=e=>a.includes(e),v=(e,t)=>[`w-full text-left px-3 py-2 text-xs focus:outline-none transition-colors`,e?`hover:bg-diff-selected-bg focus:bg-diff-selected-bg`:`hover:bg-github-bg-tertiary focus:bg-github-bg-tertiary`,e?`bg-diff-selected-bg border-l-4 border-l-diff-selected-border font-semibold pl-2`:``,t?`opacity-50 cursor-not-allowed`:`cursor-pointer`].join(` `),y=(e,r)=>e===t||r===t?!0:n?e===n||r===n:!1,b=()=>{let e=0,n=m.findIndex(e=>e.value===t);if(n!==-1)return n;if(e+=m.length,!p){let n=i.commits.findIndex(e=>e.shortHash===t);if(n!==-1)return e+n;e+=i.commits.length;let r=i.branches.findIndex(e=>e.name===t);if(r!==-1)return e+r}return 0};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`button`,{ref:c.setReference,type:`button`,className:`flex items-center gap-1.5 cursor-pointer group`,"aria-haspopup":`listbox`,"aria-expanded":o,...d(),children:[(0,j.jsxs)(`span`,{className:`text-xs text-github-text-secondary`,children:[e,`:`]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 bg-github-bg-tertiary border border-github-border rounded hover:border-github-text-secondary transition-colors`,children:[(0,j.jsx)(`code`,{className:`text-xs text-github-text-primary max-w-[150px] truncate`,children:h()}),(0,j.jsx)(Pe,{size:12,className:`text-github-text-secondary group-hover:text-github-text-primary transition-colors`})]})]}),o&&(0,j.jsx)(ps,{children:(0,j.jsx)(ws,{context:u,modal:!1,initialFocus:b(),children:(0,j.jsxs)(`div`,{ref:c.setFloating,style:l,className:`bg-github-bg-secondary border border-github-border rounded shadow-lg z-50 w-[360px] max-h-[400px] overflow-y-auto`,...f(),children:[m.length>0&&(0,j.jsxs)(`div`,{className:`border-b border-github-border`,children:[(0,j.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold text-github-text-secondary bg-github-bg-tertiary`,children:`Special`}),m.map(e=>(0,j.jsx)(`button`,{onClick:()=>g(e.value),disabled:_(e.value),className:v(e.value===t,_(e.value)),children:e.label},e.value))]}),!p&&i.commits.length>0&&(0,j.jsxs)(`div`,{className:`border-b border-github-border`,children:[(0,j.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold text-github-text-secondary bg-github-bg-tertiary`,children:`Recent Commits`}),i.commits.map(e=>(0,j.jsx)(`button`,{onClick:()=>g(e.shortHash),disabled:_(e.shortHash),className:v(y(e.shortHash,e.hash),_(e.shortHash)),children:(0,j.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,j.jsx)(`code`,{className:`text-xs text-github-text-primary font-mono whitespace-nowrap`,children:e.shortHash}),(0,j.jsx)(`span`,{className:`text-xs text-github-text-secondary flex-1 break-words`,children:e.message})]})},e.hash))]}),!p&&i.branches.length>0&&(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`px-3 py-2 text-xs font-semibold text-github-text-secondary bg-github-bg-tertiary`,children:`Branches`}),i.branches.map(e=>(0,j.jsx)(`button`,{onClick:()=>g(e.name),disabled:_(e.name),className:v(e.name===t,_(e.name)),children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`text-github-text-primary`,children:e.name}),e.current&&(0,j.jsx)(`span`,{className:`text-xs text-github-text-muted`,children:`(current)`})]})},e.name))]})]})})})]})}function _b({isOpen:e,onClose:t,options:n,selection:r,resolvedBaseRevision:i,resolvedTargetRevision:a,onApply:o}){let[s,c]=(0,A.useState)(r),{enableScope:l,disableScope:u}=ge(),d=s.baseCommitish,f=s.targetCommitish;(0,A.useEffect)(()=>{c(r)},[r]),(0,A.useEffect)(()=>(e?u(`navigation`):l(`navigation`),()=>{l(`navigation`)}),[e,l,u]);let p=(0,A.useMemo)(()=>{let e=a||f,t=n.commits.findIndex(t=>t.shortHash===e||t.hash===e);if(t===-1)return f?[f]:[];let r=n.commits.slice(0,t+1).map(e=>e.shortHash);return f&&!r.includes(f)&&r.push(f),r.includes(`working`)||r.push(`working`),r},[f,a,n.commits]),m=(0,A.useMemo)(()=>{let e=i||d,t=n.commits.findIndex(t=>t.shortHash===e||t.hash===e);if(t===-1)return d?[d]:[];let r=n.commits.slice(t).map(e=>e.shortHash);return d&&!r.includes(d)&&r.push(d),r},[d,i,n.commits]);return e?(0,j.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[(0,j.jsx)(`div`,{className:`absolute inset-0 bg-black/40`,onClick:t}),(0,j.jsxs)(`div`,{className:`relative bg-github-bg-secondary border border-github-border rounded-lg shadow-lg w-full max-w-lg mx-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-github-border`,children:[(0,j.jsx)(`h2`,{className:`text-lg font-semibold text-github-text-primary`,children:`Detailed Diff`}),(0,j.jsx)(`button`,{onClick:t,className:`text-github-text-secondary hover:text-github-text-primary p-1`,"aria-label":`Close detailed diff`,children:(0,j.jsx)(pt,{size:18})})]}),(0,j.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[(0,j.jsx)(gb,{label:`Base`,value:d,resolvedValue:i,onChange:e=>c(_t(e,s.targetCommitish)),options:n,disabledValues:p}),(0,j.jsx)(`span`,{className:`text-github-text-muted`,children:`...`}),(0,j.jsx)(gb,{label:`Target`,value:f,resolvedValue:a,onChange:e=>c(_t(s.baseCommitish,e)),options:n,disabledValues:m})]}),(0,j.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,j.jsx)(`button`,{onClick:t,className:`px-3 py-1.5 text-xs font-medium rounded border border-github-border text-github-text-secondary hover:text-github-text-primary transition-colors`,type:`button`,children:`Cancel`}),(0,j.jsx)(`button`,{onClick:()=>{o(_t(s.baseCommitish,s.targetCommitish)),t()},className:`px-3 py-1.5 text-xs font-medium rounded bg-github-accent text-white hover:bg-github-accent/90 transition-colors`,type:`button`,children:`Apply`})]})]})]})]}):null}var vb=[{id:`vscode`,label:`VS Code`,protocol:`vscode`,cliCommand:`code`,cliArgs:[],lineFormat:`goto-flag`,aliases:[`vscode`,`code`]},{id:`cursor`,label:`Cursor`,protocol:`cursor`,cliCommand:`cursor`,cliArgs:[],lineFormat:`goto-flag`,aliases:[`cursor`]},{id:`zed`,label:`Zed`,protocol:`zed`,cliCommand:`zed`,cliArgs:[],lineFormat:`path-suffix`,aliases:[`zed`]},{id:`none`,label:`Hide “Open in editor” button`,protocol:null,cliCommand:null,cliArgs:[],lineFormat:`goto-flag`,aliases:[`none`,`disabled`,`off`]}],yb=`vscode`;function bb(e){return e.replaceAll(`\\`,`/`).replace(/^\.\/+/,``)}function xb(e){return e.replace(/[|\\{}()[\]^$+?.]/g,`\\$&`)}function Sb(e){let t=new Set;return e.forEach(e=>{let n=e.trim();n&&t.add(bb(n))}),[...t]}function Cb(e){return bb(e).split(`/`).filter(e=>e.length>0)}function wb(e,t){let n=`^`;for(let e of t){if(e===`*`){n+=`.*`;continue}if(e===`?`){n+=`.`;continue}n+=xb(e)}return n+=`$`,new RegExp(n).test(e)}function Tb(e,t,n=0,r=0){if(r>=t.length)return n>=e.length;let i=t[r];if(!i)return n>=e.length;if(i===`**`){let i=r+1;if(i>=t.length)return!0;for(let r=n;r<=e.length;r+=1)if(Tb(e,t,r,i))return!0;return!1}let a=e[n];return!a||!wb(a,i)?!1:Tb(e,t,n+1,r+1)}function Eb(e){return Array.isArray(e)?Sb(e.filter(e=>typeof e==`string`)):[]}function Db(e){return Sb(e.split(/\r?\n/))}function Ob(e){return Eb(e).join(`
66
+ `)}function kb(e,t){let n=bb(t.trim());if(!n)return!1;let r=bb(e);return n.includes(`/`)?Tb(Cb(r),Cb(n)):wb(r.split(`/`).pop()??r,n)}function Ab(e,t){return Eb(t).some(t=>kb(e,t))}var jb=[{id:`github`,label:`GitHub Light`},{id:`vsLight`,label:`VS Light`},{id:`oneLight`,label:`One Light`},{id:`gruvboxMaterialLight`,label:`Gruvbox Material Light`},{id:`nightOwlLight`,label:`Night Owl Light`}],Mb=[{id:`vsDark`,label:`VS Dark`},{id:`oneDark`,label:`One Dark`},{id:`gruvboxMaterialDark`,label:`Gruvbox Material Dark`},{id:`nightOwl`,label:`Night Owl`},{id:`dracula`,label:`Dracula`},{id:`okaidia`,label:`Okaidia`}],Nb=e=>e===`light`?jb:Mb,Pb=(e,t)=>Nb(t).some(t=>t.id===e),Fb=e=>Nb(e)[0],Ib=e=>e===`top`?`translateY(4px)`:e===`bottom`?`translateY(-4px)`:e===`left`?`translateX(4px)`:`translateX(-4px)`,Lb=(e,t)=>{if(typeof e==`function`){e(t);return}e&&`current`in e&&(e.current=t)};function Rb({content:e,children:t,placement:n=`top`,className:r=``}){let[i,a]=(0,A.useState)(!1),o=(0,A.useId)(),{refs:s,floatingStyles:c,context:l}=Ps({open:i,onOpenChange:a,placement:n,middleware:[_o(8),yo(),vo({padding:8})],whileElementsMounted:oo}),u=Go(l,{move:!1}),d=Is(l),f=Ms(l),p=Bs(l,{role:`tooltip`}),{isMounted:m,styles:h}=Gs(l,{duration:{open:180,close:120},initial:({side:e})=>({opacity:0,transform:Ib(e)}),open:{opacity:1,transform:`translate(0, 0)`},close:({side:e})=>({opacity:0,transform:Ib(e)}),common:{willChange:`opacity, transform`}}),{getReferenceProps:g,getFloatingProps:_}=Rs([u,d,f,p]),v=t.props,y=g({...v,"aria-describedby":i?o:void 0}),b=[`w-64 rounded-md border border-github-border bg-github-bg-primary px-3 py-2 text-xs text-github-text-primary`,r].filter(Boolean).join(` `);return(0,j.jsxs)(j.Fragment,{children:[(0,A.cloneElement)(t,{...y,ref:e=>{Lb(v.ref,e),s.setReference(e)}}),m?(0,j.jsx)(ps,{children:(0,j.jsx)(`div`,{ref:s.setFloating,..._(),id:o,style:c,className:`z-[60]`,children:(0,j.jsx)(`div`,{style:h,className:b,children:e})})}):null]})}var zb={fontSize:14,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif`,theme:`dark`,syntaxTheme:`vsDark`,editor:yb,colorVision:`normal`,autoViewedPatterns:[]},Bb=[{name:`System Font`,value:`-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif`},{name:`Menlo`,value:`Menlo, Monaco, "Courier New", monospace`},{name:`SF Mono`,value:`SF Mono, Consolas, "Liberation Mono", monospace`},{name:`Fira Code`,value:`"Fira Code", "Courier New", monospace`},{name:`JetBrains Mono`,value:`"JetBrains Mono", "Courier New", monospace`}],Vb=[{id:`normal`,label:`Normal`},{id:`deuteranopia`,label:`Deuteranopia`,tooltip:`Deuteranopia mode uses blue/orange instead of green/red for diffs.`}],Hb=[{id:`appearance`,label:`Appearance`},{id:`system`,label:`System`}];function Ub({isOpen:e,onClose:t,settings:n,onSettingsChange:r}){let[i,a]=(0,A.useState)(Ob(n.autoViewedPatterns)),[o,s]=(0,A.useState)(`appearance`),{enableScope:c,disableScope:l}=ge();(0,A.useEffect)(()=>(e?l(`navigation`):c(`navigation`),()=>{c(`navigation`)}),[e,c,l]);let u=()=>n.theme===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:n.theme,d=()=>Nb(u()),f=e=>{let t={...n,theme:e},i=e===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e;if(!Pb(n.syntaxTheme,i)){let e=Fb(i);e&&(t.syntaxTheme=e.id)}r(t)};return e?(0,j.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center z-50 pointer-events-none`,children:(0,j.jsxs)(`div`,{className:`bg-github-bg-secondary border border-github-border rounded-lg w-full max-w-3xl mx-4 pointer-events-auto overflow-hidden`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-github-border`,children:[(0,j.jsxs)(`h2`,{className:`text-lg font-semibold text-github-text-primary flex items-center gap-2`,children:[(0,j.jsx)(ct,{size:20}),`Settings`]}),(0,j.jsx)(`button`,{onClick:t,className:`text-github-text-secondary hover:text-github-text-primary p-1`,children:(0,j.jsx)(pt,{size:18})})]}),(0,j.jsxs)(`div`,{className:`flex flex-col sm:flex-row min-h-[420px]`,children:[(0,j.jsx)(`nav`,{"aria-label":`Settings sections`,className:`sm:w-40 border-b sm:border-b-0 sm:border-r border-github-border px-3 py-2`,children:(0,j.jsx)(`div`,{className:`flex sm:flex-col gap-1`,children:Hb.map(e=>{let t=e.id===o;return(0,j.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),"aria-pressed":t,className:`flex-1 sm:flex-none text-left px-3 py-2 text-sm font-medium transition-colors border-b-2 sm:border-b-0 sm:border-l-2 ${t?`text-github-text-primary border-github-accent`:`text-github-text-secondary border-transparent hover:text-github-text-primary`}`,children:e.label},e.id)})})}),(0,j.jsxs)(`div`,{className:`flex-1 p-4 sm:p-6 overflow-y-auto`,children:[o===`appearance`&&(0,j.jsxs)(`div`,{className:`space-y-6`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Font Size`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(`input`,{type:`range`,min:`10`,max:`20`,step:`1`,value:n.fontSize,onChange:e=>r({...n,fontSize:Number.parseInt(e.target.value,10)}),className:`flex-1 accent-github-accent`}),(0,j.jsxs)(`span`,{className:`text-sm text-github-text-secondary w-8 text-right`,children:[n.fontSize,`px`]})]})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Font Family`}),(0,j.jsx)(`select`,{value:n.fontFamily,onChange:e=>r({...n,fontFamily:e.target.value}),className:`w-full p-2 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary text-sm`,children:Bb.map(e=>(0,j.jsx)(`option`,{value:e.value,children:e.name},e.value))})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Theme`}),(0,j.jsx)(`div`,{className:`flex gap-2`,children:[`light`,`dark`,`auto`].map(e=>(0,j.jsx)(`button`,{type:`button`,onClick:()=>f(e),className:`px-3 py-2 text-sm rounded border transition-colors ${n.theme===e?`bg-github-accent text-white border-github-accent`:`bg-github-bg-tertiary text-github-text-secondary border-github-border hover:text-github-text-primary`}`,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Color Vision`}),(0,j.jsx)(`div`,{className:`flex gap-2`,children:Vb.map(e=>{let t=(0,j.jsx)(`button`,{type:`button`,onClick:()=>r({...n,colorVision:e.id}),className:`px-3 py-2 text-sm rounded border transition-colors ${(n.colorVision??`normal`)===e.id?`bg-github-accent text-white border-github-accent`:`bg-github-bg-tertiary text-github-text-secondary border-github-border hover:text-github-text-primary`}`,children:e.label},e.id);return`tooltip`in e?(0,j.jsx)(Rb,{content:e.tooltip,children:t},e.id):t})})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Syntax Highlighting Theme`}),(0,j.jsx)(`select`,{value:n.syntaxTheme,onChange:e=>r({...n,syntaxTheme:e.target.value}),className:`w-full p-2 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary text-sm`,children:d().map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.label},e.id))})]})]}),o===`system`&&(0,j.jsxs)(`div`,{className:`space-y-6`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Open In Editor`}),(0,j.jsx)(`select`,{value:n.editor,onChange:e=>r({...n,editor:e.target.value}),className:`w-full p-2 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary text-sm`,children:vb.map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:`auto-viewed-patterns`,className:`block text-sm font-medium text-github-text-primary mb-2`,children:`Auto-Mark Viewed Patterns`}),(0,j.jsx)(`p`,{className:`text-sm text-github-text-secondary mb-2`,children:`Files matching these glob patterns are marked as Viewed automatically. Enter one pattern per line.`}),(0,j.jsx)(`textarea`,{id:`auto-viewed-patterns`,value:i,onChange:e=>{a(e.target.value),r({...n,autoViewedPatterns:Db(e.target.value)})},rows:6,spellCheck:!1,placeholder:`*.test.ts
67
67
  *.stories.tsx
68
- src/generated/**`,className:`w-full p-3 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary text-sm font-mono`})]})]})]})]}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-t border-github-border`,children:[(0,j.jsx)(`button`,{onClick:()=>{if(o===`appearance`){r({...n,fontSize:Lb.fontSize,fontFamily:Lb.fontFamily,theme:Lb.theme,syntaxTheme:Lb.syntaxTheme,colorVision:Lb.colorVision});return}r({...n,editor:Lb.editor,autoViewedPatterns:Lb.autoViewedPatterns}),a(Eb(Lb.autoViewedPatterns))},className:`px-3 py-2 text-sm text-github-text-secondary hover:text-github-text-primary`,children:o===`appearance`?`Reset Appearance Defaults`:`Reset System Defaults`}),(0,j.jsx)(`button`,{onClick:t,className:`px-4 py-2 text-sm bg-github-accent text-white rounded hover:bg-green-600`,children:`Close`})]})]})}):null}var Hb={position:`absolute`,fontSize:`16px`,pointerEvents:`none`,zIndex:100,transform:`translateY(20px) scale(0.5)`,opacity:0},Ub=({isActive:e})=>e?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`animate-sparkle-rise`,style:{...Hb,left:`-12px`,animationDelay:`0s`},children:`✨`}),(0,j.jsx)(`div`,{className:`animate-sparkle-rise`,style:{...Hb,right:`-12px`,animationDelay:`0.3s`},children:`✨`})]}):null,Wb={fontSize:14,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif`,theme:`dark`,syntaxTheme:`vsDark`,editor:_b,colorVision:`normal`,autoViewedPatterns:[]};function Gb(){let[e,t]=(0,A.useState)(()=>{try{let e=localStorage.getItem(o);if(e){let t=JSON.parse(e);return{...Wb,...t,autoViewedPatterns:wb(t.autoViewedPatterns)}}}catch(e){console.warn(`Failed to load appearance settings from localStorage:`,e)}return Wb}),n=(0,A.useCallback)((e,t=`normal`)=>{_(e,t)},[]),r=(0,A.useCallback)(e=>{try{localStorage.setItem(o,JSON.stringify(e))}catch(e){console.warn(`Failed to save appearance settings to localStorage:`,e)}},[]),i=(0,A.useCallback)((e,t)=>{if(Mb(e.syntaxTheme,t))return e;let n=Nb(t);return n?{...e,syntaxTheme:n.id}:e},[]);return(0,A.useEffect)(()=>{let a=document.documentElement;a.style.setProperty(`--app-font-size`,`${e.fontSize}px`),a.style.setProperty(`--app-font-family`,e.fontFamily);let o=e.colorVision??`normal`,s=a=>{n(a,o);let s=i(e,a);s!==e&&(t(s),r(s))};if(e.theme===`auto`){let e=window.matchMedia(`(prefers-color-scheme: dark)`);s(m(`auto`,e.matches?`dark`:`light`));let t=e=>{s(m(`auto`,e.matches?`dark`:`light`))};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}else{s(e.theme);return}},[e,n,i,r]),{settings:e,updateSettings:e=>{t(e),r(e)}}}function Kb(e){return typeof e==`number`?`L${e}`:`L${e[0]}-L${e[1]}`}function qb(e,t){if(wt(e)){let n=Tt(e);if(n.length>0){let r=``,i=0;for(let a of n){let n=e.slice(i,a.startIndex).trim();n&&(r+=`${r?`
68
+ src/generated/**`,className:`w-full p-3 bg-github-bg-tertiary border border-github-border rounded text-github-text-primary text-sm font-mono`})]})]})]})]}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-t border-github-border`,children:[(0,j.jsx)(`button`,{onClick:()=>{if(o===`appearance`){r({...n,fontSize:zb.fontSize,fontFamily:zb.fontFamily,theme:zb.theme,syntaxTheme:zb.syntaxTheme,colorVision:zb.colorVision});return}r({...n,editor:zb.editor,autoViewedPatterns:zb.autoViewedPatterns}),a(Ob(zb.autoViewedPatterns))},className:`px-3 py-2 text-sm text-github-text-secondary hover:text-github-text-primary`,children:o===`appearance`?`Reset Appearance Defaults`:`Reset System Defaults`}),(0,j.jsx)(`button`,{onClick:t,className:`px-4 py-2 text-sm bg-github-accent text-white rounded hover:bg-green-600`,children:`Close`})]})]})}):null}var Wb={position:`absolute`,fontSize:`16px`,pointerEvents:`none`,zIndex:100,transform:`translateY(20px) scale(0.5)`,opacity:0},Gb=({isActive:e})=>e?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`animate-sparkle-rise`,style:{...Wb,left:`-12px`,animationDelay:`0s`},children:`✨`}),(0,j.jsx)(`div`,{className:`animate-sparkle-rise`,style:{...Wb,right:`-12px`,animationDelay:`0.3s`},children:`✨`})]}):null,Kb={fontSize:14,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif`,theme:`dark`,syntaxTheme:`vsDark`,editor:yb,colorVision:`normal`,autoViewedPatterns:[]};function qb(){let[e,t]=(0,A.useState)(()=>{try{let e=localStorage.getItem(o);if(e){let t=JSON.parse(e);return{...Kb,...t,autoViewedPatterns:Eb(t.autoViewedPatterns)}}}catch(e){console.warn(`Failed to load appearance settings from localStorage:`,e)}return Kb}),n=(0,A.useCallback)((e,t=`normal`)=>{_(e,t)},[]),r=(0,A.useCallback)(e=>{try{localStorage.setItem(o,JSON.stringify(e))}catch(e){console.warn(`Failed to save appearance settings to localStorage:`,e)}},[]),i=(0,A.useCallback)((e,t)=>{if(Pb(e.syntaxTheme,t))return e;let n=Fb(t);return n?{...e,syntaxTheme:n.id}:e},[]);return(0,A.useEffect)(()=>{let a=document.documentElement;a.style.setProperty(`--app-font-size`,`${e.fontSize}px`),a.style.setProperty(`--app-font-family`,e.fontFamily);let o=e.colorVision??`normal`,s=a=>{n(a,o);let s=i(e,a);s!==e&&(t(s),r(s))};if(e.theme===`auto`){let e=window.matchMedia(`(prefers-color-scheme: dark)`);s(m(`auto`,e.matches?`dark`:`light`));let t=e=>{s(m(`auto`,e.matches?`dark`:`light`))};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}else{s(e.theme);return}},[e,n,i,r]),{settings:e,updateSettings:e=>{t(e),r(e)}}}function Jb(e){return typeof e==`number`?`L${e}`:`L${e[0]}-L${e[1]}`}function Yb(e,t){if(wt(e)){let n=Tt(e);if(n.length>0){let r=``,i=0;for(let a of n){let n=e.slice(i,a.startIndex).trim();n&&(r+=`${r?`
69
69
  `:``}${n}`),t&&(r+=`${r?`
70
70
  `:``}ORIGINAL:\n\`\`\`\n${t}\n\`\`\``),r+=`${r?`
71
71
  `:``}SUGGESTED:\n\`\`\`\n${a.suggestedCode}\n\`\`\``,i=a.endIndex}let a=e.slice(i).trim();return a&&(r+=`${r?`
72
- `:``}${a}`),r}}return e}function Jb(e){let t=[`${e.file||`<unknown file>`}:${Kb(e.line)}`];return e.messages.forEach((n,r)=>{if(r===0){t.push(qb(n.body,e.codeContent));return}let i=r,a=n.author?.trim()||`Unknown`;t.push(`Reply ${i} (${a})`),t.push(qb(n.body,e.codeContent))}),t.filter(Boolean).join(`
73
- `)}function Yb(e){return e.length===0?``:e.map(e=>Jb(e)).join(`
72
+ `:``}${a}`),r}}return e}function Xb(e){let t=[`${e.file||`<unknown file>`}:${Jb(e.line)}`];return e.messages.forEach((n,r)=>{if(r===0){t.push(Yb(n.body,e.codeContent));return}let i=r,a=n.author?.trim()||`Unknown`;t.push(`Reply ${i} (${a})`),t.push(Yb(n.body,e.codeContent))}),t.filter(Boolean).join(`
73
+ `)}function Zb(e){return e.length===0?``:e.map(e=>Xb(e)).join(`
74
74
  =====
75
- `)}var Xb=`abcdefghijklmnopqrstuvwxyz0123456789`,Zb=16;function Qb(){return Array.from({length:Zb},()=>Xb[Math.floor(Math.random()*36)]).join(``)}function $b(e){return typeof e.line==`number`?`${e.side}:${e.line}`:`${e.side}:${e.line.start}-${e.line.end}`}function ex(e,t){return $b(e)===$b(t)}function tx(e){return e?.trim()||``}function nx(e,t,n=!0){return n&&t.id&&e.id===t.id?!0:!(tx(e.author)!==tx(t.author)||e.body!==t.body||t.createdAt&&e.createdAt!==t.createdAt)}function rx(e,t){if(t.id&&e.id===t.id)return!0;if(e.filePath!==t.filePath||!ex(e.position,t.position))return!1;let n=e.messages[0];return n?nx(n,t,!0):!1}function ix(e,t){let n=e.createdAt??t;return{createdAt:n,updatedAt:e.updatedAt??n}}function ax(e,t){return e.localeCompare(t)>=0?e:t}function ox(e,t){return t.updatedAt.localeCompare(e.updatedAt)}function sx(e,t){let{createdAt:n,updatedAt:r}=ix(e,t),i=e.id??Qb();return{id:i,filePath:e.filePath,createdAt:n,updatedAt:r,position:e.position,codeSnapshot:e.codeSnapshot,messages:[{id:e.id??i,body:e.body,author:e.author,createdAt:n,updatedAt:r}]}}function cx(e,t){let{createdAt:n,updatedAt:r}=ix(e,t);return{id:e.id??Qb(),body:e.body,author:e.author,createdAt:n,updatedAt:r}}function lx(e,t){let n=[...e],r=[];for(let e of t){let t=new Date().toISOString();if(e.type===`thread`){if(n.some(t=>rx(t,e)))continue;n.push(sx(e,t));continue}let i=n.filter(t=>t.filePath===e.filePath&&ex(t.position,e.position)).sort(ox)[0];if(!i){r.push(`Skipped reply import for ${e.filePath}:${$b(e.position)} because no matching thread was found.`);continue}if(i.messages.some(t=>nx(t,e,!0)))continue;let a=cx(e,t);i.messages=[...i.messages,a],i.updatedAt=ax(i.updatedAt,a.updatedAt)}return{threads:n,warnings:r}}var ux=`difit-storage-v1`;function dx(e){return{id:e.id,filePath:e.filePath,createdAt:e.createdAt,updatedAt:e.updatedAt,position:e.position,codeSnapshot:e.codeSnapshot,messages:[{id:e.id,body:e.body,author:e.author,createdAt:e.createdAt,updatedAt:e.updatedAt}]}}function fx(e){let t=e.messages[0];return t?{id:e.id,filePath:e.filePath,body:t.body,author:t.author,createdAt:t.createdAt,updatedAt:t.updatedAt,position:e.position,codeSnapshot:e.codeSnapshot}:null}var px=new class{generateStorageKey(e,t,n){let r=e=>e.replace(/[^a-zA-Z0-9-_]/g,e=>`_${e.charCodeAt(0).toString(16)}_`),i=`${r(e)}-${r(t)}`;return gt(n)===`merge-base`?`${i}-merge-base`:i}getFullStorageKey(e,t){return e?`${ux}/${e}/${t}`:`${ux}/${t}`}normalizeCommitish(e,t,n){if(e===`.`||e===`working`)return`WORKING`;if(e===`staged`)return`STAGED`;if((e===`HEAD`||e===`@`)&&t)return t;if(n?.has(e)){let t=n.get(e);if(t)return t}return(e.startsWith(`@`)||e.includes(`^`)||e.includes(`~`)||e.includes(`HEAD`))&&console.warn(`[StorageService] Cannot normalize symbolic ref '${e}' - may cause key collision. currentCommitHash=${t}`),e}getStorageKey(e,t,n,r,i,a){let o=this.normalizeStorageBase(e,t,n,r),s=this.normalizeStorageTarget(e,t,n,r),c=this.generateStorageKey(o,s,a);return this.getFullStorageKey(i,c)}getDiffContextData(e,t,n,r,i,a){try{let o=this.getStorageKey(e,t,n,r,i,a),s=localStorage.getItem(o);if(!s)return null;let c=JSON.parse(s);return c.version===2&&`threads`in c?c:c.version===1&&`comments`in c?{version:2,baseCommitish:c.baseCommitish,targetCommitish:c.targetCommitish,createdAt:c.createdAt,lastModifiedAt:c.lastModifiedAt,threads:c.comments.map(dx),viewedFiles:c.viewedFiles,appliedCommentImportIds:[]}:(console.warn(`Unknown storage version: ${String(c.version)}`),null)}catch(e){return console.error(`Error reading diff context data:`,e),null}}normalizeStorageBase(e,t,n,r){return t===`.`||t===`working`||t===`staged`?n||e:this.normalizeCommitish(e,n,r)}normalizeStorageTarget(e,t,n,r){return t===`.`||t===`working`?`WORKING`:t===`staged`?`STAGED`:this.normalizeCommitish(t,n,r)}saveDiffContextData(e,t,n,r,i,a,o){try{let s=this.getStorageKey(e,t,r,i,a,o),c={...n,version:2,baseCommitish:e,targetCommitish:t,baseMode:o,lastModifiedAt:new Date().toISOString(),appliedCommentImportIds:n.appliedCommentImportIds||[]};localStorage.setItem(s,JSON.stringify(c))}catch(e){e instanceof DOMException&&e.name===`QuotaExceededError`?console.error(`localStorage quota exceeded`):console.error(`Error saving diff context data:`,e)}}getCommentThreads(e,t,n,r,i,a){return this.getDiffContextData(e,t,n,r,i,a)?.threads||[]}getComments(e,t,n,r,i,a){return this.getCommentThreads(e,t,n,r,i,a).map(e=>fx(e)).filter(e=>e!==null)}saveCommentThreads(e,t,n,r,i,a,o){let s=this.getDiffContextData(e,t,r,i,a,o)||{version:2,baseCommitish:e,targetCommitish:t,baseMode:o,createdAt:new Date().toISOString(),lastModifiedAt:new Date().toISOString(),threads:[],viewedFiles:[],appliedCommentImportIds:[]};s.threads=n,this.saveDiffContextData(e,t,s,r,i,a,o)}saveComments(e,t,n,r,i,a,o){this.saveCommentThreads(e,t,n.map(dx),r,i,a,o)}getViewedFiles(e,t,n,r,i,a){return this.getDiffContextData(e,t,n,r,i,a)?.viewedFiles||[]}saveViewedFiles(e,t,n,r,i,a,o){let s=this.getDiffContextData(e,t,r,i,a,o)||{version:2,baseCommitish:e,targetCommitish:t,baseMode:o,createdAt:new Date().toISOString(),lastModifiedAt:new Date().toISOString(),threads:[],viewedFiles:[],appliedCommentImportIds:[]};s.viewedFiles=n,this.saveDiffContextData(e,t,s,r,i,a,o)}cleanupOldData(e){let t=new Date;t.setDate(t.getDate()-e);let n=t.getTime(),r=[];for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);if(t?.startsWith(ux))try{let e=localStorage.getItem(t);if(!e)continue;let i=JSON.parse(e);new Date(i.lastModifiedAt).getTime()<n&&r.push(t)}catch{}}r.forEach(e=>localStorage.removeItem(e))}getStorageSize(){let e=0;for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(!n?.startsWith(ux))continue;let r=localStorage.getItem(n);r&&(e+=(n.length+r.length)*2)}return e}};async function mx(e){try{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}catch{return console.warn(`Crypto API not available, using fallback hash`),hx(e)}}function hx(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}function gx(e){let t=e.chunks.map(e=>{let t=e.lines.filter(e=>e.type!==`hunk`&&e.type!==`header`).map(e=>`${e.type}:${e.content}`).join(`
75
+ `)}var Qb=`abcdefghijklmnopqrstuvwxyz0123456789`,$b=16;function ex(){return Array.from({length:$b},()=>Qb[Math.floor(Math.random()*36)]).join(``)}function tx(e){return typeof e.line==`number`?`${e.side}:${e.line}`:`${e.side}:${e.line.start}-${e.line.end}`}function nx(e,t){return tx(e)===tx(t)}function rx(e){return e?.trim()||``}function ix(e,t,n=!0){return n&&t.id&&e.id===t.id?!0:!(rx(e.author)!==rx(t.author)||e.body!==t.body||t.createdAt&&e.createdAt!==t.createdAt)}function ax(e,t){if(t.id&&e.id===t.id)return!0;if(e.filePath!==t.filePath||!nx(e.position,t.position))return!1;let n=e.messages[0];return n?ix(n,t,!0):!1}function ox(e,t){let n=e.createdAt??t;return{createdAt:n,updatedAt:e.updatedAt??n}}function sx(e,t){return e.localeCompare(t)>=0?e:t}function cx(e,t){return t.updatedAt.localeCompare(e.updatedAt)}function lx(e,t){let{createdAt:n,updatedAt:r}=ox(e,t),i=e.id??ex();return{id:i,filePath:e.filePath,createdAt:n,updatedAt:r,position:e.position,codeSnapshot:e.codeSnapshot,messages:[{id:e.id??i,body:e.body,author:e.author,createdAt:n,updatedAt:r}]}}function ux(e,t){let{createdAt:n,updatedAt:r}=ox(e,t);return{id:e.id??ex(),body:e.body,author:e.author,createdAt:n,updatedAt:r}}function dx(e,t){let n=[...e],r=[];for(let e of t){let t=new Date().toISOString();if(e.type===`thread`){if(n.some(t=>ax(t,e)))continue;n.push(lx(e,t));continue}let i=n.filter(t=>t.filePath===e.filePath&&nx(t.position,e.position)).sort(cx)[0];if(!i){r.push(`Skipped reply import for ${e.filePath}:${tx(e.position)} because no matching thread was found.`);continue}if(i.messages.some(t=>ix(t,e,!0)))continue;let a=ux(e,t);i.messages=[...i.messages,a],i.updatedAt=sx(i.updatedAt,a.updatedAt)}return{threads:n,warnings:r}}var fx=`difit-storage-v1`;function px(e){return{id:e.id,filePath:e.filePath,createdAt:e.createdAt,updatedAt:e.updatedAt,position:e.position,codeSnapshot:e.codeSnapshot,messages:[{id:e.id,body:e.body,author:e.author,createdAt:e.createdAt,updatedAt:e.updatedAt}]}}function mx(e){let t=e.messages[0];return t?{id:e.id,filePath:e.filePath,body:t.body,author:t.author,createdAt:t.createdAt,updatedAt:t.updatedAt,position:e.position,codeSnapshot:e.codeSnapshot}:null}var hx=new class{generateStorageKey(e,t,n){let r=e=>e.replace(/[^a-zA-Z0-9-_]/g,e=>`_${e.charCodeAt(0).toString(16)}_`),i=`${r(e)}-${r(t)}`;return gt(n)===`merge-base`?`${i}-merge-base`:i}getFullStorageKey(e,t){return e?`${fx}/${e}/${t}`:`${fx}/${t}`}normalizeCommitish(e,t,n){if(e===`.`||e===`working`)return`WORKING`;if(e===`staged`)return`STAGED`;if((e===`HEAD`||e===`@`)&&t)return t;if(n?.has(e)){let t=n.get(e);if(t)return t}return(e.startsWith(`@`)||e.includes(`^`)||e.includes(`~`)||e.includes(`HEAD`))&&console.warn(`[StorageService] Cannot normalize symbolic ref '${e}' - may cause key collision. currentCommitHash=${t}`),e}getStorageKey(e,t,n,r,i,a){let o=this.normalizeStorageBase(e,t,n,r),s=this.normalizeStorageTarget(e,t,n,r),c=this.generateStorageKey(o,s,a);return this.getFullStorageKey(i,c)}getDiffContextData(e,t,n,r,i,a){try{let o=this.getStorageKey(e,t,n,r,i,a),s=localStorage.getItem(o);if(!s)return null;let c=JSON.parse(s);return c.version===2&&`threads`in c?c:c.version===1&&`comments`in c?{version:2,baseCommitish:c.baseCommitish,targetCommitish:c.targetCommitish,createdAt:c.createdAt,lastModifiedAt:c.lastModifiedAt,threads:c.comments.map(px),viewedFiles:c.viewedFiles,appliedCommentImportIds:[]}:(console.warn(`Unknown storage version: ${String(c.version)}`),null)}catch(e){return console.error(`Error reading diff context data:`,e),null}}normalizeStorageBase(e,t,n,r){return t===`.`||t===`working`||t===`staged`?n||e:this.normalizeCommitish(e,n,r)}normalizeStorageTarget(e,t,n,r){return t===`.`||t===`working`?`WORKING`:t===`staged`?`STAGED`:this.normalizeCommitish(t,n,r)}saveDiffContextData(e,t,n,r,i,a,o){try{let s=this.getStorageKey(e,t,r,i,a,o),c={...n,version:2,baseCommitish:e,targetCommitish:t,baseMode:o,lastModifiedAt:new Date().toISOString(),appliedCommentImportIds:n.appliedCommentImportIds||[]};localStorage.setItem(s,JSON.stringify(c))}catch(e){e instanceof DOMException&&e.name===`QuotaExceededError`?console.error(`localStorage quota exceeded`):console.error(`Error saving diff context data:`,e)}}getCommentThreads(e,t,n,r,i,a){return this.getDiffContextData(e,t,n,r,i,a)?.threads||[]}getComments(e,t,n,r,i,a){return this.getCommentThreads(e,t,n,r,i,a).map(e=>mx(e)).filter(e=>e!==null)}saveCommentThreads(e,t,n,r,i,a,o){let s=this.getDiffContextData(e,t,r,i,a,o)||{version:2,baseCommitish:e,targetCommitish:t,baseMode:o,createdAt:new Date().toISOString(),lastModifiedAt:new Date().toISOString(),threads:[],viewedFiles:[],appliedCommentImportIds:[]};s.threads=n,this.saveDiffContextData(e,t,s,r,i,a,o)}saveComments(e,t,n,r,i,a,o){this.saveCommentThreads(e,t,n.map(px),r,i,a,o)}getViewedFiles(e,t,n,r,i,a){return this.getDiffContextData(e,t,n,r,i,a)?.viewedFiles||[]}saveViewedFiles(e,t,n,r,i,a,o){let s=this.getDiffContextData(e,t,r,i,a,o)||{version:2,baseCommitish:e,targetCommitish:t,baseMode:o,createdAt:new Date().toISOString(),lastModifiedAt:new Date().toISOString(),threads:[],viewedFiles:[],appliedCommentImportIds:[]};s.viewedFiles=n,this.saveDiffContextData(e,t,s,r,i,a,o)}cleanupOldData(e){let t=new Date;t.setDate(t.getDate()-e);let n=t.getTime(),r=[];for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);if(t?.startsWith(fx))try{let e=localStorage.getItem(t);if(!e)continue;let i=JSON.parse(e);new Date(i.lastModifiedAt).getTime()<n&&r.push(t)}catch{}}r.forEach(e=>localStorage.removeItem(e))}getStorageSize(){let e=0;for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(!n?.startsWith(fx))continue;let r=localStorage.getItem(n);r&&(e+=(n.length+r.length)*2)}return e}};async function gx(e){try{let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}catch{return console.warn(`Crypto API not available, using fallback hash`),_x(e)}}function _x(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}function vx(e){let t=e.chunks.map(e=>{let t=e.lines.filter(e=>e.type!==`hunk`&&e.type!==`header`).map(e=>`${e.type}:${e.content}`).join(`
76
76
  `);return`${e.header}\n${t}`}).join(`
77
77
 
78
- `);return`${e.path}\n${e.status}\n${t}`}function _x(e){return{id:e.id,file:e.filePath,line:typeof e.position.line==`number`?e.position.line:[e.position.line.start,e.position.line.end],side:e.position.side,createdAt:e.createdAt,updatedAt:e.updatedAt,codeContent:e.codeSnapshot?.content,messages:e.messages}}function vx(e){let t=e.messages[0];return t?{id:e.id,filePath:e.filePath,body:t.body,author:t.author,createdAt:t.createdAt,updatedAt:t.updatedAt,position:e.position,codeSnapshot:e.codeSnapshot}:null}function yx(e,t,n,r,i,a){let[o,s]=(0,A.useState)([]),c=(0,A.useCallback)(()=>!e||!t?null:px.getDiffContextData(e,t,n,r,i,a),[e,t,n,r,i,a]),l=(0,A.useCallback)(()=>{if(!e||!t)return null;let n=new Date().toISOString();return{version:2,baseCommitish:e,targetCommitish:t,baseMode:a,createdAt:n,lastModifiedAt:n,threads:[],viewedFiles:[],appliedCommentImportIds:[]}},[e,t,a]);(0,A.useEffect)(()=>{!e||!t||s(c()?.threads||px.getCommentThreads(e,t,n,r,i,a))},[e,t,n,r,i,a,c]);let u=(0,A.useCallback)(o=>{!e||!t||(px.saveCommentThreads(e,t,o,n,r,i,a),s(o))},[e,t,n,r,i,a]),d=(0,A.useCallback)(e=>{let t=new Date().toISOString(),n=Qb(),r={id:n,filePath:e.filePath,createdAt:t,updatedAt:t,position:{side:e.side,line:e.line},codeSnapshot:e.codeSnapshot||{content:``,language:Gn(e.filePath)},messages:[{id:n,body:e.body,author:`User`,createdAt:t,updatedAt:t}]};return u([...o,r]),r},[u,o]),f=(0,A.useCallback)(e=>{let t=vx(d(e));if(!t)throw Error(`Failed to create root comment`);return t},[d]),p=(0,A.useCallback)(({threadId:e,body:t})=>{let n=new Date().toISOString();u(o.map(r=>r.id===e?{...r,updatedAt:n,messages:[...r.messages,{id:Qb(),body:t,author:`User`,createdAt:n,updatedAt:n}]}:r))},[u,o]),m=(0,A.useCallback)(e=>{u(o.filter(t=>t.id!==e))},[u,o]),h=(0,A.useCallback)(e=>{m(e)},[m]),g=(0,A.useCallback)((e,t)=>{let n=o.find(t=>t.id===e);if(!n)return;let r=n.messages.findIndex(e=>e.id===t);if(r<0)return;if(r===0){m(e);return}let i=new Date().toISOString();u(o.map(n=>n.id===e?{...n,updatedAt:i,messages:n.messages.filter(e=>e.id!==t)}:n))},[m,u,o]),_=(0,A.useCallback)((e,t,n)=>{let r=new Date().toISOString();u(o.map(i=>i.id===e?{...i,updatedAt:r,messages:i.messages.map(e=>e.id===t?{...e,body:n,updatedAt:r}:e)}:i))},[u,o]),v=(0,A.useCallback)((e,t)=>{_(e,e,t)},[_]),y=(0,A.useCallback)(()=>{u([])},[u]),b=(0,A.useCallback)(o=>{if(!o?.resetAppliedCommentImportIds){y();return}let u=c()||l();if(!u||!e||!t)return;let d={...u,threads:[],appliedCommentImportIds:[]};px.saveDiffContextData(e,t,d,n,r,i,a),s([])},[e,t,r,y,l,n,c,i,a]),x=(0,A.useCallback)((o,u)=>{if(!e||!t||o.length===0||u.length===0)return[];let d=c()||l();if(!d)return[];if(d.appliedCommentImportIds.includes(u))return s(d.threads),[];let f=lx(d.threads,o),p={...d,threads:f.threads,appliedCommentImportIds:[...d.appliedCommentImportIds,u]};return px.saveDiffContextData(e,t,p,n,r,i,a),s(f.threads),f.warnings},[e,t,r,l,n,c,i,a]),S=(0,A.useCallback)(e=>{let t=o.find(t=>t.id===e);return t?Jb(_x(t)):``},[o]),C=(0,A.useCallback)(e=>S(e),[S]),w=(0,A.useCallback)(()=>Yb(o.map(_x)),[o]);return{comments:o.map(e=>vx(e)).filter(e=>e!==null),threads:o,addComment:f,addThread:d,removeComment:h,replyToThread:p,removeThread:m,updateComment:v,removeMessage:g,updateMessage:_,clearAllComments:b,applyCommentImports:x,generatePrompt:C,generateThreadPrompt:S,generateAllCommentsPrompt:w}}var bx=20;async function xx(e,t){let n=await fetch(`/api/blob/${encodeURIComponent(e)}?ref=${encodeURIComponent(t)}`);if(!n.ok)throw Error(`Failed to fetch file content: ${n.statusText}`);let r=(await n.text()).split(`
79
- `);return r.length>0&&r[r.length-1]===``&&r.pop(),{lines:r,totalLines:r.length}}async function Sx(e,t,n,r){let i=encodeURIComponent(e),a=new URLSearchParams;t&&a.set(`oldRef`,t),n&&a.set(`newRef`,n),r&&r!==e&&a.set(`oldPath`,r);let o=await fetch(`/api/line-count/${i}?${a}`);if(!o.ok)throw Error(`Failed to fetch line count: ${o.statusText}`);return o.json()}function Cx({baseCommitish:e,targetCommitish:t,diffIdentity:n}){let[r,i]=(0,A.useState)({}),[a,o]=(0,A.useState)(!1),[s,c]=(0,A.useState)(null),[l,u]=(0,A.useState)(0),d=(0,A.useRef)(new Map),f=(0,A.useRef)({});f.current=r;let p=(0,A.useRef)(0);(0,A.useEffect)(()=>{p.current+=1,d.current.clear(),f.current={},i({}),o(!1),c(null),u(0)},[e,t,n]);let m=(0,A.useCallback)(async n=>{let r=p.current,i=`${r}:${n.path}`,a=d.current.get(i);if(a)return a;let o=(async()=>{let i=f.current[n.path];if(i?.oldContent&&i?.newContent)return i;let a={...i,expandedRanges:i?.expandedRanges||[]};if(n.status!==`added`&&e){let t=n.oldPath||n.path;try{let{lines:n,totalLines:i}=await xx(t,e);if(p.current!==r)return null;a.oldContent=n,a.oldTotalLines=i}catch(e){console.error(`Failed to fetch old file content:`,e),a.oldContent=[],a.oldTotalLines=0}}if(n.status!==`deleted`&&t)try{let{lines:e,totalLines:i}=await xx(n.path,t);if(p.current!==r)return null;a.newContent=e,a.newTotalLines=i}catch(e){console.error(`Failed to fetch new file content:`,e),a.newContent=[],a.newTotalLines=0}return a})();d.current.set(i,o);try{return await o}finally{d.current.delete(i)}},[e,t]),h=(0,A.useCallback)(e=>{c(e),u(e=>e+1)},[]),g=(0,A.useCallback)(async(e,t,n,r=bx)=>{let a=p.current;o(!0);try{let o=await m(e);if(!o||p.current!==a)return;i(i=>{let a=i[e.path],s=a?.expandedRanges||o.expandedRanges||[],c=s.findIndex(e=>e.chunkIndex===t&&e.direction===n),l=[...s];if(c>=0&&l[c]){let e=l[c];l[c]={chunkIndex:e.chunkIndex,direction:e.direction,count:e.count+r}}else l.push({chunkIndex:t,direction:n,count:r});return{...i,[e.path]:{oldContent:a?.oldContent??o.oldContent,newContent:a?.newContent??o.newContent,oldTotalLines:a?.oldTotalLines??o.oldTotalLines,newTotalLines:a?.newTotalLines??o.newTotalLines,expandedRanges:l}}}),h(e.path)}finally{o(!1)}},[m,h]),_=(0,A.useCallback)(async(e,t,n)=>{let r=p.current;o(!0);try{let a=await m(e);if(!a||p.current!==r)return;i(r=>{let i=r[e.path],o=[...i?.expandedRanges||a.expandedRanges||[]],s=o.findIndex(e=>e.chunkIndex===t&&e.direction===`up`),c=o.findIndex(e=>e.chunkIndex===t-1&&e.direction===`down`),l=0,u=0;s>=0&&o[s]&&(l=o[s].count),c>=0&&o[c]&&(u=o[c].count);let d=l+u+n,f=o.filter(e=>!(e.chunkIndex===t-1&&e.direction===`down`)),p=f.findIndex(e=>e.chunkIndex===t&&e.direction===`up`);return p>=0&&f[p]?f[p]={chunkIndex:t,direction:`up`,count:d}:f.push({chunkIndex:t,direction:`up`,count:d}),{...r,[e.path]:{oldContent:i?.oldContent??a.oldContent,newContent:i?.newContent??a.newContent,oldTotalLines:i?.oldTotalLines??a.oldTotalLines,newTotalLines:i?.newTotalLines??a.newTotalLines,expandedRanges:f}}}),h(e.path)}finally{o(!1)}},[m,h]),v=(0,A.useCallback)(async n=>{let r=p.current,a=f.current[n.path];if(a?.oldTotalLines!==void 0||a?.newTotalLines!==void 0)return;let o=n.status===`added`?void 0:e,s=n.status===`deleted`?void 0:t;if(!(!o&&!s))try{let{oldLineCount:e,newLineCount:t}=await Sx(n.path,o,s,n.oldPath);if(p.current!==r)return;i(r=>{let i=r[n.path];return i?.oldTotalLines!==void 0||i?.newTotalLines!==void 0?r:{...r,[n.path]:{...i,expandedRanges:i?.expandedRanges||[],oldTotalLines:e,newTotalLines:t}}}),h(n.path)}catch(e){console.error(`Failed to prefetch line count:`,e)}},[e,t,h]),y=(0,A.useCallback)((e,t,n)=>{let i=r[e];return i&&i.expandedRanges.find(e=>e.chunkIndex===t&&e.direction===n)?.count||0},[r]),b=(0,A.useCallback)((e,t,n)=>{if(e.status===`added`||e.status===`deleted`)return 0;let r=e.chunks[n-1],i;if(!r)i=t.oldStart-1;else{let e=r.oldStart+r.oldLines;i=t.oldStart-e}let a=y(e.path,n,`up`),o=n>0?y(e.path,n-1,`down`):0;return Math.max(0,i-a-o)},[y]),x=(0,A.useCallback)((e,t,n)=>{if(e.status===`added`||e.status===`deleted`)return 0;let i=r[e.path],a=i?.oldTotalLines||i?.newTotalLines;if(a===void 0)return e.chunks[n+1]?0:-1;if(e.chunks[n+1])return 0;let o=a-(t.oldStart+t.oldLines-1),s=y(e.path,n,`down`);return Math.max(0,o-s)},[r,y]),S=(0,A.useCallback)((e,t,n)=>{let i=r[e.path];if(!i)return t;let a=y(e.path,n,`up`),o=y(e.path,n,`down`);if(a===0&&o===0)return t;let s=i.oldContent||[],c=i.newContent||[],l=[];if(a>0){let r=e.chunks[n-1],i;i=r?r.oldStart+r.oldLines-1:Math.max(0,t.oldStart-1-a);let o=t.oldStart-1,u=t.newStart-1,d=Math.min(a,o-i),f=o-d,p=u-d;for(let e=0;e<d;e++){let t=f+e+1,n=p+e+1,r=s[t-1]??c[n-1]??``;l.push({type:`normal`,content:r,oldLineNumber:t,newLineNumber:n,isExpanded:!0})}}if(l.push(...t.lines),o>0){let r=t.oldStart+t.oldLines-1,a=t.newStart+t.newLines-1,u=e.chunks[n+1],d=u?u.oldStart-1:i.oldTotalLines||r,f=Math.min(o,d-r);for(let e=0;e<f;e++){let t=r+e+1,n=a+e+1,i=s[t-1]??c[n-1]??``;l.push({type:`normal`,content:i,oldLineNumber:t,newLineNumber:n,isExpanded:!0})}}let u=l[0],d=l[l.length-1];return{...t,lines:l,oldStart:u?.oldLineNumber??t.oldStart,newStart:u?.newLineNumber??t.newStart,oldLines:(d?.oldLineNumber??t.oldStart+t.oldLines-1)-(u?.oldLineNumber??t.oldStart)+1,newLines:(d?.newLineNumber??t.newStart+t.newLines-1)-(u?.newLineNumber??t.newStart)+1}},[r,y]);return{expandedState:r,isLoading:a,lastUpdatedFilePath:s,lastUpdatedAt:l,expandLines:g,expandAllBetweenChunks:_,prefetchFileContent:v,getMergedChunks:(0,A.useCallback)(e=>{let t=[];for(let n=0;n<e.chunks.length;n++){let r=e.chunks[n];if(!r)continue;let i=S(e,r,n),a=b(e,r,n),o=x(e,r,n),s=t[t.length-1];if(s&&a===0){s.lines=[...s.lines,...i.lines],s.originalIndices.push(n),s.hiddenLinesAfter=o;let e=s.lines[s.lines.length-1];s.oldLines=(e?.oldLineNumber??s.oldStart+s.oldLines-1)-s.oldStart+1,s.newLines=(e?.newLineNumber??s.newStart+s.newLines-1)-s.newStart+1}else t.push({...i,originalIndices:[n],hiddenLinesBefore:a,hiddenLinesAfter:o})}return t},[S,b,x]),getHiddenLinesBefore:b,getHiddenLinesAfter:x}}var wx=function(e){return e.DEFAULT=`default`,e.WORKING=`working`,e.STAGED=`staged`,e.DOT=`dot`,e.SPECIFIC=`specific`,e}({});function Tx(e){let t=(void 0)?.trim();if(!t)return e;try{return new URL(e,t).toString()}catch{return e}}function Ex(e){let t=(0,A.useRef)(null),n=(0,A.useRef)(null),r=(0,A.useRef)(0),i=3e3,[a,o]=(0,A.useState)({isWatchEnabled:!1,diffMode:wx.DEFAULT,shouldReload:!1,isReloading:!1,lastChangeTime:null,lastChangeType:null,connectionStatus:`disconnected`}),[s,c]=(0,A.useState)(null),l=(0,A.useCallback)(()=>{if(!t.current)try{let e=new EventSource(Tx(`/api/watch`));t.current=e,e.onopen=()=>{console.log(`Connected to file watch service`),o(e=>({...e,connectionStatus:`connected`})),r.current=0,c(null)},e.onmessage=e=>{try{let t=JSON.parse(e.data);switch(t.type){case`connected`:o(e=>({...e,isWatchEnabled:!0,diffMode:t.diffMode,connectionStatus:`connected`}));break;case`reload`:console.log(`File changes detected, showing reload button:`,t.changeType),o(e=>({...e,shouldReload:!0,lastChangeTime:new Date,lastChangeType:t.changeType}));break;case`error`:console.error(`File watch error:`,t.message),c(t.message||`File watch error occurred`);break}}catch(e){console.error(`Error parsing watch event:`,e)}},e.onerror=()=>{console.log(`File watch connection lost`),o(e=>({...e,connectionStatus:`disconnected`})),t.current&&=(t.current.close(),null),r.current<5?(o(e=>({...e,connectionStatus:`reconnecting`})),r.current+=1,n.current=setTimeout(()=>{console.log(`Attempting to reconnect to file watch service (${r.current}/5)...`),l()},i)):(console.error(`Max reconnection attempts reached`),c(`Lost connection to file watch service`))}}catch(e){console.error(`Failed to connect to file watch service:`,e),c(`Failed to connect to file watch service`)}},[5,i]),u=(0,A.useCallback)(async()=>{if(!a.isReloading){o(e=>({...e,isReloading:!0}));try{e&&await e(),o(e=>({...e,shouldReload:!1,isReloading:!1,lastChangeTime:null,lastChangeType:null}))}catch(e){console.error(`Reload failed:`,e),c(`Failed to reload diff data`),o(e=>({...e,isReloading:!1}))}}},[e,a.isReloading]),d=()=>{t.current&&=(t.current.close(),null),n.current&&=(clearTimeout(n.current),null)};return(0,A.useEffect)(()=>(l(),d),[l]),(0,A.useEffect)(()=>d,[]),{shouldReload:a.shouldReload,isConnected:a.connectionStatus===`connected`,error:s,reload:u,watchState:a}}var Dx={SCROLL_CONTAINER:`main.overflow-y-auto`};function Ox(e,t){let n=`file-${e.fileIndex}-chunk-${e.chunkIndex}-line-${e.lineIndex}`;return t===`split`?`${n}-${e.side}`:n}function kx(e,t,n){return`${e}:${t}:${n??`any`}`}function Ax(e,t){let n=t[e.fileIndex]?.chunks[e.chunkIndex]?.lines[e.lineIndex];return n&&(n.type===`add`||n.type===`delete`||n.type===`normal`)?n.type:null}function jx(e,t){let n=Ax(e,t);return n?n===`normal`?!0:n===`delete`?e.side===`left`:n===`add`?e.side===`right`:!1:!1}function Mx(e,t){return jx(e,t)?e:{...e,side:e.side===`left`?`right`:`left`}}var Nx={VIEWPORT_OFFSET_RATIO:1/3};function Px(e,t,n){let r=[];return t.oldLineNumber!==void 0&&(r.push(kx(e,t.oldLineNumber,`old`)),r.push(kx(e,t.oldLineNumber))),t.newLineNumber!==void 0&&(r.push(kx(e,t.newLineNumber,`new`)),r.push(kx(e,t.newLineNumber))),r.some(e=>n.has(e))}function Fx(e,t,n,r){return{line:t=>{let i=e[t.fileIndex];return!i||r?.has(i.path)?!1:n===`unified`||jx(t,e)},chunk:t=>{let n=e[t.fileIndex];if(!n||r?.has(n.path))return!1;let i=n.chunks[t.chunkIndex]?.lines[t.lineIndex];if(!i||i.type===`normal`)return!1;if(t.lineIndex===0)return!0;let a=n.chunks[t.chunkIndex]?.lines[t.lineIndex-1];return!a||a.type===`normal`},comment:n=>{let i=e[n.fileIndex];if(!i||r?.has(i.path))return!1;let a=i.chunks[n.chunkIndex]?.lines[n.lineIndex];return a?Px(i.path,a,t):!1},file:e=>e.chunkIndex===0&&e.lineIndex===0}}function Ix(){return e=>{let t=document.getElementById(e);if(!t)return;let n=document.querySelector(Dx.SCROLL_CONTAINER);if(!n)throw Error(`Scrollable container (${Dx.SCROLL_CONTAINER}) not found`);let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=n.clientHeight,o=n.scrollTop,s=Math.max(i.top,0),c=Math.min(i.bottom,window.innerHeight);if(!(r.top>=s&&r.bottom<=c)){let e=Lx(t,n)-a*Nx.VIEWPORT_OFFSET_RATIO;n.scrollTop=Math.max(0,e);return}let l=r.bottom>Math.min(i.bottom,window.innerHeight),u=t.offsetTop-n.offsetTop-a*Nx.VIEWPORT_OFFSET_RATIO;l&&u>o&&(n.scrollTop=Math.max(0,u))}}function Lx(e,t){let n=e,r=0;for(;n&&n!==t&&n.offsetParent;)r+=n.offsetTop,n=n.offsetParent;return n&&n!==t&&(r+=n.offsetTop),r}function Rx(e){return e||{fileIndex:0,chunkIndex:0,lineIndex:-1,side:`right`}}function zx(e,t,n){return n&&e.fileIndex===t.fileIndex&&e.chunkIndex===t.chunkIndex&&e.lineIndex===t.lineIndex}function Bx(e,t,n){let{fileIndex:r,chunkIndex:i,lineIndex:a}=e,o=n.length,s=0;if(t===`next`)for(a++;s<o;){if(n[r]?.chunks[i]?.lines[a])return{...e,fileIndex:r,chunkIndex:i,lineIndex:a};i++,a=0,n[r]?.chunks[i]||(r++,i=0,a=0,r>=o&&(r=0,s++))}else for(a--;s<o;){if(a<0)if(i--,i<0){r--,r<0&&(r=o-1,s++);let e=n[r];if(e&&e.chunks.length>0){i=e.chunks.length-1;let t=e.chunks[i];a=t&&t.lines.length>0?t.lines.length-1:-1}else i=-1,a=-1}else{let e=n[r]?.chunks[i];a=e&&e.lines.length>0?e.lines.length-1:-1}if(a>=0&&n[r]?.chunks[i]?.lines[a])return{...e,fileIndex:r,chunkIndex:i,lineIndex:a};a<0||a--}return null}function Vx(e,t,n,r,i){let a=e,o=!1;for(;a;){let s=Bx(a,t,r);if(!s||(a=s,zx(a,e,o)))break;if(o=!0,n(a,r)){let e=Mx(a,r);return{position:e,scrollTarget:Ox(e,i)}}}return{position:null,scrollTarget:null}}function Hx({files:e,comments:t,viewMode:n=mt,reviewedFiles:r,onToggleReviewed:i,onCreateComment:a,onCopyAllComments:o,onDeleteAllComments:s,onShowCommentsList:c,onRefresh:l}){let[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(!1),m=(0,A.useMemo)(()=>Ix(),[]),h=(0,A.useMemo)(()=>{let e=new Map;return t.forEach(t=>{let n=Array.isArray(t.line)?t.line[0]:t.line,r=kx(t.file,n,t.side);e.has(r)||e.set(r,[]),e.get(r)?.push(t)}),e},[t]),g=(0,A.useMemo)(()=>Fx(e,h,n,r),[e,h,n,r]),_=(0,A.useCallback)((t,r)=>e.length===0?{position:null,scrollTarget:null}:Vx(Rx(u),t,r,e,n),[u,e,n]),v=(0,A.useCallback)(e=>t=>{let n=_(t,e);n.position&&(d(n.position),n.scrollTarget&&m(n.scrollTarget))},[_,m]),y=(0,A.useMemo)(()=>v(g.line),[v,g.line]),b=(0,A.useMemo)(()=>v(g.chunk),[v,g.chunk]),x=(0,A.useMemo)(()=>v(g.file),[v,g.file]),S=(0,A.useMemo)(()=>v(g.comment),[v,g.comment]),C=(0,A.useCallback)(t=>{if(!u||n!==`split`)return;let r={...u,side:t},i=e[u.fileIndex]?.chunks[u.chunkIndex]?.lines[u.lineIndex];if(i){if(t===`left`&&i.type===`add`&&u.lineIndex>0){if(e[u.fileIndex]?.chunks[u.chunkIndex]?.lines[u.lineIndex-1]?.type===`delete`){r={...r,lineIndex:u.lineIndex-1},d(r),m(Ox(r,n));return}}else if(t===`right`&&i.type===`delete`&&e[u.fileIndex]?.chunks[u.chunkIndex]?.lines[u.lineIndex+1]?.type===`add`){r={...r,lineIndex:u.lineIndex+1},d(r),m(Ox(r,n));return}}if(!jx(r,e)){let t=e[u.fileIndex];if(!t)return;let n=t.chunks[u.chunkIndex];if(n){for(let t=u.lineIndex+1;t<n.lines.length;t++){let n={...r,lineIndex:t};if(jx(n,e)){r=n;break}}if(!jx(r,e))for(let t=u.lineIndex-1;t>=0;t--){let n={...r,lineIndex:t};if(jx(n,e)){r=n;break}}}if(!jx(r,e)){for(let n=u.chunkIndex+1;n<t.chunks.length;n++){let i=t.chunks[n];if(i){for(let t=0;t<i.lines.length;t++){let i={...r,chunkIndex:n,lineIndex:t};if(jx(i,e)){r=i;break}}if(jx(r,e))break}}if(!jx(r,e))for(let n=u.chunkIndex-1;n>=0;n--){let i=t.chunks[n];if(i){for(let t=i.lines.length-1;t>=0;t--){let i={...r,chunkIndex:n,lineIndex:t};if(jx(i,e)){r=i;break}}if(jx(r,e))break}}}}d(r),m(Ox(r,n))},[u,n,m,e]),w=(0,A.useCallback)(()=>{let t=document.querySelector(Dx.SCROLL_CONTAINER);if(!t)return;let r=t.getBoundingClientRect(),i=r.top+r.height/2,a=1/0,o=null;e.forEach((t,s)=>{t.chunks.forEach((t,c)=>{t.lines.forEach((t,l)=>{let u=n===`split`?[`left`,`right`]:[`right`];for(let t of u){let u={fileIndex:s,chunkIndex:c,lineIndex:l,side:t};if(n===`split`&&!jx(u,e))continue;let d=Ox(u,n),f=document.getElementById(d);if(f){let e=f.getBoundingClientRect(),t=e.top+e.height/2,n=Math.abs(t-i);e.top<r.bottom&&e.bottom>r.top&&n<a&&(a=n,o=u)}}})})}),o&&d(o)},[e,n,d]),T=(0,A.useCallback)(t=>{if(!t){d(null);return}let r=Mx(t,e);d(r),m(Ox(r,n))},[e,n,m]),E={scopes:`navigation`,enableOnFormTags:!1,preventDefault:!0};return xe(`j, down`,()=>y(`next`),E,[y]),xe(`k, up`,()=>y(`prev`),E,[y]),xe(`n`,()=>b(`next`),E,[b]),xe(`p`,()=>b(`prev`),E,[b]),xe(`shift+n`,()=>S(`next`),E,[S]),xe(`shift+p`,()=>S(`prev`),E,[S]),xe(`]`,()=>x(`next`),{...E,useKey:!0},[x]),xe(`[`,()=>x(`prev`),{...E,useKey:!0},[x]),xe(`{`,()=>{e.length>0&&(d({fileIndex:0,chunkIndex:0,lineIndex:0,side:n===`split`?`left`:`right`}),m(Ox({fileIndex:0,chunkIndex:0,lineIndex:0,side:n===`split`?`left`:`right`},n)))},{...E,useKey:!0},[e,n,m]),xe(`}`,()=>{if(e.length>0){let t=e.length-1,r=e[t];r&&r.chunks.length>0&&(d({fileIndex:t,chunkIndex:0,lineIndex:0,side:n===`split`?`left`:`right`}),m(Ox({fileIndex:t,chunkIndex:0,lineIndex:0,side:n===`split`?`left`:`right`},n)))}},{...E,useKey:!0},[e,n,m]),xe(`h, left`,()=>C(`left`),{...E,enabled:n===`split`},[C,n]),xe(`l, right`,()=>C(`right`),{...E,enabled:n===`split`},[C,n]),xe(`v`,()=>{if(u){let t=e[u.fileIndex];t&&i(t.path)}},E,[u,e,i]),xe(`shift+r`,()=>{l&&l()},E,[l]),xe(`c`,()=>{if(u&&a){let t=e[u.fileIndex]?.chunks[u.chunkIndex]?.lines[u.lineIndex];t&&t.type!==`delete`&&a()}},E,[u,e,a]),xe(`?`,()=>p(!f),{...E,useKey:!0},[f]),xe(`.`,e=>{e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||(w(),e.preventDefault())},{...E,useKey:!0,preventDefault:!1},[w]),xe(`shift+c`,()=>{o&&o()},{...E,scopes:[`navigation`,`comments-list`]},[o]),xe(`shift+d`,()=>{s&&s()},{...E,scopes:[`navigation`,`comments-list`]},[s]),xe(`shift+l`,()=>{c&&c()},E,[c]),{cursor:u,isHelpOpen:f,setIsHelpOpen:p,setCursorPosition:T}}var Ux=new Map,Wx=0;function Gx(e){return Ux.has(e)||Ux.set(e,`file-${++Wx}`),Ux.get(e)??``}var Kx=8,qx=`1200px 0px`,Jx=60,Yx=180;function Xx({diffData:e,diffScrollContainerRef:t,setDiffData:n}){let[r,i]=(0,A.useState)(new Set),a=(0,A.useRef)(new Set),o=(0,A.useRef)(null),s=(0,A.useRef)(new Map),c=(0,A.useRef)(new Set),l=(0,A.useRef)(null),u=(0,A.useRef)(0);(0,A.useEffect)(()=>{if(!e){let e=new Set;a.current=e,i(e),c.current.clear(),l.current=null;return}let t=`${e.requestedBaseCommitish??``}:${e.requestedTargetCommitish??``}:${e.requestedBaseMode??`direct`}`;if(l.current===t)return;l.current=t;let n=e.files.slice(0,Kx).map(e=>e.path),r=new Set(n);a.current=r,i(r),c.current.clear()},[e]);let d=(0,A.useCallback)(e=>{let t=s.current.get(e);t&&o.current&&o.current.unobserve(t),i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),a.current=n,n})},[]),f=(0,A.useCallback)((e,t)=>{let n=o.current,r=s.current.get(e);if(r&&n&&n.unobserve(r),!t){s.current.delete(e);return}s.current.set(e,t),!(a.current.has(e)||!n)&&n.observe(t)},[]);(0,A.useEffect)(()=>{if(o.current&&o.current.disconnect(),!e){o.current=null;return}let n=new IntersectionObserver(e=>{i(t=>{let r=!1,i=new Set(t);return e.forEach(e=>{if(!e.isIntersecting)return;let t=e.target.dataset.filePath;!t||i.has(t)||(i.add(t),n.unobserve(e.target),r=!0)}),r&&(a.current=i),r?i:t})},{root:t.current,rootMargin:qx});return o.current=n,s.current.forEach((e,t)=>{a.current.has(t)||n.observe(e)}),()=>{n.disconnect(),o.current=null}},[e,t]);let p=(0,A.useCallback)(t=>{if(!e)return;let n=e.files.findIndex(e=>e.path===t);if(n<0)return;let r=o.current;i(t=>{let i=!1,o=new Set(t);for(let t=0;t<=n;t++){let n=e.files[t]?.path;if(n&&!o.has(n)){o.add(n),i=!0;let e=s.current.get(n);e&&r&&r.unobserve(e)}}return i&&(a.current=o),i?o:t})},[e]),m=(0,A.useCallback)(n=>{p(n);let r=e?.files.findIndex(e=>e.path===n)??-1,i=e&&r>=0?e.files.slice(0,r+1).map(e=>Gx(e.path)):[Gx(n)],a=u.current+1;u.current=a;let o=()=>{for(let e of i){let t=document.getElementById(e);if(!t||t.dataset.rendered!==`true`)return!1}return!0},s=e=>{let r=t.current,i=document.getElementById(Gx(n));if(!r||!i)return!1;let a=r.getBoundingClientRect(),o=i.getBoundingClientRect(),s=r.scrollTop+(o.top-a.top);return r.scrollTo({top:Math.max(0,s),behavior:e}),!0},c=0,l=()=>{requestAnimationFrame(()=>{if(u.current===a){if(!o()){c<Jx&&(c++,l());return}if(!s(`smooth`)){c<Jx&&(c++,l());return}window.setTimeout(()=>{u.current===a&&s(`smooth`)},Yx)}})};l()},[e,t,p]);return(0,A.useEffect)(()=>{if(!e||e.targetCommitish===`stdin`)return;let t=e.targetCommitish||`HEAD`,i=`${e.requestedBaseCommitish??``}...${e.requestedTargetCommitish??``}:${e.requestedBaseMode??`direct`}`;e.files.forEach(a=>{if(!r.has(a.path)||a.isGenerated!==!1||a.status===`deleted`)return;let o=`${i}:${t}:${a.path}`;if(c.current.has(o))return;c.current.add(o);let s=encodeURIComponent(a.path);fetch(`/api/generated-status/${s}?ref=${encodeURIComponent(t)}`).then(e=>e.ok?e.json():null).then(t=>{!t||t.isGenerated!==!0||n(t=>{if(!t||t.requestedBaseCommitish!==e.requestedBaseCommitish||t.requestedTargetCommitish!==e.requestedTargetCommitish||t.requestedBaseMode!==e.requestedBaseMode)return t;let n=!1,r=t.files.map(e=>e.path!==a.path||e.isGenerated?e:(n=!0,{...e,isGenerated:!0}));return n?{...t,files:r}:t})}).catch(()=>{})})},[e,r,n]),{renderedFilePaths:r,ensureFileRendered:d,ensureFilesRenderedUpTo:p,registerLazyFileContainer:f,scrollFileIntoDiffContainer:m}}function Zx(e,t,n,r,i,a,o=[],s){let[c,l]=(0,A.useState)([]),[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(new Map),m=e&&t?`${a??`default`}:${yt({baseCommitish:e,targetCommitish:t,baseMode:s})}:${n??`no-commit`}`:null,h=m!==null&&u===m;(0,A.useEffect)(()=>{if(!e||!t||!m)return;let c=!1,u=px.getViewedFiles(e,t,n,r,a,s);return(async()=>{if(i&&i.length>0){let f=[],p=new Set(u.map(e=>e.filePath));for(let e of i)if((e.isGenerated||e.status===`deleted`||Ob(e.path,o))&&!p.has(e.path))try{let t=await mx(gx(e)),n={filePath:e.path,viewedAt:new Date().toISOString(),diffContentHash:t};f.push(n)}catch(e){console.error(`Failed to generate hash for auto-collapsed file:`,e)}if(f.length>0){let i=[...u,...f];px.saveViewedFiles(e,t,i,n,r,a,s),c||(l(i),d(m));return}}c||(l(u),d(m))})(),()=>{c=!0}},[e,t,n,r,a,m,s]);let g=(0,A.useCallback)(i=>{!e||!t||(px.saveViewedFiles(e,t,i,n,r,a,s),l(i))},[e,t,n,r,a,s]),_=(0,A.useMemo)(()=>new Set(c.map(e=>e.filePath)),[c]),v=(0,A.useCallback)(e=>c.find(t=>t.filePath===e),[c]),y=(0,A.useCallback)(async e=>{let t=f.get(e.path);if(t)return t;let n=await mx(gx(e));return p(t=>new Map(t).set(e.path,n)),n},[f]),b=(0,A.useCallback)(async(e,t)=>{let n=v(e);if(!n)return!1;let r=await y(t);return n.diffContentHash!==r},[v,y]);return{viewedFiles:_,hasLoadedInitialViewedFiles:h,toggleFileViewed:(0,A.useCallback)(async(e,t)=>{if(v(e))g(c.filter(t=>t.filePath!==e));else{let n=await y(t),r={filePath:e,viewedAt:new Date().toISOString(),diffContentHash:n};g([...c,r])}},[c,v,y,g]),isFileContentChanged:b,getViewedFileRecord:v,clearViewedFiles:(0,A.useCallback)(()=>{g([]),p(new Map)},[g])}}var Qx={mobileMax:767,desktopMin:1024},$x={mobile:`(max-width: ${Qx.mobileMax}px)`,desktop:`(min-width: ${Qx.desktopMin}px)`},eS=()=>typeof window>`u`?{isMobile:!1,isDesktop:!0}:{isMobile:window.matchMedia($x.mobile).matches,isDesktop:window.matchMedia($x.desktop).matches};function tS(){let[e,t]=(0,A.useState)(()=>eS());return(0,A.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia($x.mobile),n=window.matchMedia($x.desktop),r=()=>{t({isMobile:e.matches,isDesktop:n.matches})};return r(),e.addEventListener(`change`,r),n.addEventListener(`change`,r),()=>{e.removeEventListener(`change`,r),n.removeEventListener(`change`,r)}},[]),e}function nS(e){let t=new Set;return e.forEach(e=>{let n=e.author?.trim();n&&t.add(n)}),[...t]}function rS(e){return nS(e).length>=2}function iS(e,t,n,r){for(let i=0;i<e.chunks.length;i++){let a=e.chunks[i];if(a)for(let e=0;e<a.lines.length;e++){let o=a.lines[e];if(o&&(r===`old`?o.oldLineNumber:r===`new`?o.newLineNumber:o.newLineNumber??o.oldLineNumber)===n)return{fileIndex:t,chunkIndex:i,lineIndex:e,side:r===`old`?`left`:r===`new`||o.newLineNumber?`right`:`left`}}}return null}function aS(e,t){let n=t.findIndex(t=>t.path===e.file);if(n===-1)return null;let r=t[n];if(!r)return null;let i=Array.isArray(e.line)?e.line[1]:e.line,a=e.side;return iS(r,n,i,a)||iS(r,n,i,`new`)||iS(r,n,i,`old`)}var oS={diffVersion:null,byFile:new Map};function sS(e,t,n,r){let i=new Map;return t.forEach(e=>{let t=n.get(e);t&&i.set(e,r(t))}),{diffVersion:e,byFile:i}}function cS(e,t,n){if(e.diffVersion===t)return e.byFile.get(n)}var lS=[],uS=[],dS=`difit.sidebarWidth`,fS=`difit.sidebarOpen`,pS=200,mS=600,hS=280,gS=()=>{if(typeof window>`u`)return hS;let e=window.localStorage.getItem(dS);if(!e)return hS;let t=Number.parseInt(e,10);return Number.isFinite(t)?Math.min(mS,Math.max(pS,t)):hS},_S=()=>{if(typeof window>`u`)return!0;let e=window.localStorage.getItem(fS);return e===null||e===`true`?!0:e!==`false`};function vS(){let[e,t]=(0,A.useState)(null),[n,r]=(0,A.useState)(0),[i,a]=(0,A.useState)(mt),o=(0,A.useRef)(!1),[s,c]=(0,A.useState)(!0),[l,u]=(0,A.useState)(!0),[d,f]=(0,A.useState)(null),[p,m]=(0,A.useState)(!1),[h,g]=(0,A.useState)(gS),[_,v]=(0,A.useState)(!1),[y,b]=(0,A.useState)(_S),[x,S]=(0,A.useState)(!1),[C,w]=(0,A.useState)(!1),[T,E]=(0,A.useState)(!1),[D,O]=(0,A.useState)(!1),[k,M]=(0,A.useState)(!1),[N,P]=(0,A.useState)(new Set),ee=(0,A.useRef)(!1),F=(0,A.useRef)(null),[I,te]=(0,A.useState)(null),[ne,re]=(0,A.useState)(_t(``,``)),[L,ie]=(0,A.useState)(``),[R,ae]=(0,A.useState)(``),oe=(0,A.useRef)(!1),se=(0,A.useRef)(ne.baseMode);se.current=e?.requestedBaseMode??ne.baseMode;let ce=(0,A.useRef)(ne);ce.current=ne;let le=(0,A.useRef)(0),ue=(0,A.useRef)(null),de=(0,A.useMemo)(()=>!e?.baseCommitish||!e?.targetCommitish?null:_t(e.baseCommitish,e.targetCommitish,e.requestedBaseMode),[e]),fe=(0,A.useMemo)(()=>de?yt(de):null,[de]),{settings:pe,updateSettings:me}=Gb(),{isMobile:z,isDesktop:he}=tS(),{threads:ge,addThread:_e,replyToThread:ve,removeThread:ye,removeMessage:be,updateMessage:xe,clearAllComments:Se,applyCommentImports:Ce,generateThreadPrompt:we,generateAllCommentsPrompt:Te}=yx(de?.baseCommitish,de?.targetCommitish,e?.commit,void 0,e?.repositoryId,de?.baseMode),Ee=(0,A.useMemo)(()=>ge.map(e=>({id:e.id,file:e.filePath,line:typeof e.position.line==`number`?e.position.line:[e.position.line.start,e.position.line.end],side:e.position.side,createdAt:e.createdAt,updatedAt:e.updatedAt,codeContent:e.codeSnapshot?.content,messages:e.messages})),[ge]),De=(0,A.useMemo)(()=>rS(Ee.flatMap(e=>e.messages)),[Ee]),Oe=(0,A.useMemo)(()=>{let e=new Map;return Ee.forEach(t=>{let n=e.get(t.file);n?n.push(t):e.set(t.file,[t])}),e},[Ee]),ke=z&&ge.length>0,{viewedFiles:Ae,hasLoadedInitialViewedFiles:B,toggleFileViewed:je,clearViewedFiles:Me}=Zx(de?.baseCommitish,de?.targetCommitish,e?.commit,void 0,e?.files,e?.repositoryId,pe.autoViewedPatterns,de?.baseMode);(0,A.useEffect)(()=>{ee.current=!1},[e?.repositoryId,fe,e?.commit]),(0,A.useEffect)(()=>{!ee.current&&B&&(P(new Set(Ae)),ee.current=!0)},[Ae,B]);let{renderedFilePaths:Ne,ensureFileRendered:Pe,ensureFilesRenderedUpTo:Fe,registerLazyFileContainer:Ie,scrollFileIntoDiffContainer:Le}=Xx({diffData:e,diffScrollContainerRef:F,setDiffData:t}),Re=(0,A.useCallback)(async t=>{if(!e)return;let n=e.files.find(e=>e.path===t);if(!n)return;let r=Ae.has(t);await je(t,n),P(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n}),r||setTimeout(()=>{Le(t)},100)},[e,Le,je,Ae]),ze=(0,A.useCallback)(e=>{P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Ve=(0,A.useCallback)(t=>{e&&P(t?new Set(e.files.map(e=>e.path)):new Set)},[e]),He=(0,A.useCallback)(()=>{b(!1)},[]),Ue=(0,A.useCallback)(e=>{o.current=!0,a(e)},[]),{isLoading:We,expandLines:Ge,expandAllBetweenChunks:Ke,prefetchFileContent:qe,getMergedChunks:Je,lastUpdatedAt:Ye}=Cx({baseCommitish:e?.baseCommitish,targetCommitish:e?.targetCommitish,diffIdentity:n}),Xe=(0,A.useRef)(Je);(0,A.useEffect)(()=>{Xe.current=Je},[Je]);let[Ze,$e]=(0,A.useState)(oS),et=(0,A.useMemo)(()=>{let t=new Map;return e?.files.forEach(e=>{t.set(e.path,e)}),t},[e]);(0,A.useEffect)(()=>{if(!e){$e(oS);return}$e(sS(n,Ne,et,e=>Xe.current(e)))},[e,n,et,Ne,Ye]);let tt=(0,A.useMemo)(()=>e?e.files.map(e=>({...e,chunks:cS(Ze,n,e.path)||e.chunks})):[],[e,n,Ze]),[nt,at]=(0,A.useState)(null),{shouldReload:ot,reload:st,watchState:lt}=Ex(async()=>{await Ot()}),{cursor:dt,isHelpOpen:ft,setIsHelpOpen:pt,setCursorPosition:St}=Hx({files:tt,comments:Ee,viewMode:i,reviewedFiles:Ae,onToggleReviewed:Re,onCreateComment:()=>{dt&&at({fileIndex:dt.fileIndex,chunkIndex:dt.chunkIndex,lineIndex:dt.lineIndex})},onCopyAllComments:()=>{ge.length>0&&Mt()},onDeleteAllComments:()=>{ge.length>0&&confirm(`Delete all comments?`)&&Se()},onShowCommentsList:()=>{O(!0)},onRefresh:()=>{st()}});(0,A.useEffect)(()=>{if(!e||!dt)return;let t=e.files[dt.fileIndex]?.path;!t||Ne.has(t)||(Fe(t),requestAnimationFrame(()=>{St(dt)}))},[dt,e,Fe,Ne,St]);let wt=(0,A.useCallback)((e,t,n,r)=>{St({fileIndex:e,chunkIndex:t,lineIndex:n,side:r})},[St]),Tt=(0,A.useCallback)(()=>{at(null)},[at]),Et=(0,A.useCallback)(e=>we(e.id),[we]),Dt=e=>{e.preventDefault(),S(!0);let t=e.clientX,n=h,r=e=>{g(Math.max(pS,Math.min(mS,n+(e.clientX-t))))},i=()=>{S(!1),document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},Ot=(0,A.useCallback)(async e=>{let n=le.current+1;le.current=n,ue.current?.abort();let i=new AbortController;ue.current=i;try{let c=e??(oe.current?ce.current:void 0),l=new URLSearchParams({ignoreWhitespace:String(s)});c?.baseCommitish&&l.set(`base`,c.baseCommitish),c?.targetCommitish&&l.set(`target`,c.targetCommitish),c?.baseMode===`merge-base`&&l.set(`baseMode`,c.baseMode);let u=await fetch(`/api/diff?${l}`,{signal:i.signal});if(!u.ok)throw Error(`Failed to fetch diff data`);let d=await u.json();if(le.current!==n)return;if(t(d),r(e=>e+1),ie(d.baseCommitish&&d.requestedBaseMode!==`merge-base`?d.baseCommitish:``),d.targetCommitish&&ae(d.targetCommitish),!oe.current){let e=d.requestedBaseCommitish??d.baseCommitish,t=d.requestedTargetCommitish??d.targetCommitish;e&&t&&re(_t(e,t,d.requestedBaseMode))}d.mode&&!o.current&&a(ht(d.mode))}catch(e){if(e?.name===`AbortError`||le.current!==n)return;f(e instanceof Error?e.message:`Unknown error`)}finally{ue.current===i&&(ue.current=null),le.current===n&&u(!1)}},[s]);(0,A.useEffect)(()=>{Ot()},[Ot]),(0,A.useEffect)(()=>()=>{ue.current?.abort()},[]),(0,A.useEffect)(()=>{z&&i!==`unified`&&a(`unified`)},[i,z]),(0,A.useEffect)(()=>{try{window.localStorage.setItem(dS,String(h))}catch{}},[h]),(0,A.useEffect)(()=>{try{window.localStorage.setItem(fS,String(y))}catch{}},[y]),(0,A.useEffect)(()=>{fetch(`/api/revisions`).then(e=>e.ok?e.json():null).then(e=>{te(e),e?.resolvedBase&&gt(se.current)!==`merge-base`&&ie(t=>t||e.resolvedBase||``),e?.resolvedTarget&&ae(t=>t||e.resolvedTarget||``)}).catch(()=>te(null))},[]);let kt=(0,A.useCallback)(async e=>{vt(e,ne)||(oe.current=!0,ce.current=e,re(e),u(!0),f(null),await Ot(e))},[Ot,ne]),At=(0,A.useRef)(!1);(0,A.useEffect)(()=>{e?.clearComments&&!At.current&&(At.current=!0,Se({resetAppliedCommentImportIds:!0}),Me(),console.log(`✅ All existing comments and viewed files cleared as requested via --clean flag`))},[e?.clearComments,Se,Me]),(0,A.useEffect)(()=>{!e?.commentImportId||!e.commentImports?.length||Ce(e.commentImports,e.commentImportId).forEach(e=>console.warn(e))},[Ce,e?.commentImportId,e?.commentImports]),(0,A.useEffect)(()=>{e&&(Ae.size<e.files.length?E(!1):Ae.size===e.files.length&&!T&&(w(!0),E(!0),setTimeout(()=>{w(!1)},1e3)))},[Ae.size,e,T]),(0,A.useEffect)(()=>{let e=JSON.stringify({threads:Ee});fetch(`/api/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:e}).catch(e=>{console.error(`Failed to sync comments:`,e)});let t=()=>{navigator.sendBeacon(`/api/comments`,e)};return window.addEventListener(`beforeunload`,t),()=>{window.removeEventListener(`beforeunload`,t)}},[Ee]),(0,A.useEffect)(()=>{let e=new EventSource(Tx(`/api/heartbeat`));return e.onopen=()=>{console.log(`Connected to server heartbeat`)},e.onerror=()=>{console.log(`Server connection lost`),e.close()},()=>{e.close()}},[]);let jt=(0,A.useCallback)((e,t,n,r,i)=>(_e({filePath:e,body:n,side:i||`new`,line:typeof t==`number`?t:{start:t[0],end:t[1]},codeSnapshot:r?{content:r,language:void 0}:void 0}),Promise.resolve()),[_e]),Mt=async()=>{try{await Ct(Te()),m(!0),setTimeout(()=>m(!1),2e3)}catch(e){console.error(`Failed to copy all comments prompt:`,e)}},Nt=(0,A.useCallback)((e,t)=>(ve({threadId:e,body:t}),Promise.resolve()),[ve]),Ft=t=>{if(!e)return;let n=aS(t,e.files);n&&St(n)},It=(0,A.useCallback)(async(e,t)=>{try{let n=await fetch(`/api/open-in-editor`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:e,line:t,editor:pe.editor})});if(!n.ok){let e=await n.json().catch(()=>null),t=n.statusText;e&&typeof e==`object`&&`error`in e&&typeof e.error==`string`&&(t=e.error),console.error(`Failed to open file in editor:`,t)}}catch(e){console.error(`Failed to open file in editor:`,e)}},[pe.editor]),Lt=e=>{St(null);let t=e.target,n=t.closest(`[data-comment-button="true"]`),r=t.closest(`[data-open-in-editor-button="true"]`);!n&&!r&&Rt(e)},Rt=e=>{document.querySelectorAll(`form[data-empty="true"]`).forEach(t=>{t.contains(e.target)||t.querySelector(`button[type="button"]`)?.click()})};if(l)return(0,j.jsx)(`div`,{className:`flex items-center justify-center h-screen bg-github-bg-primary`,children:(0,j.jsx)(`div`,{className:`text-github-text-secondary text-base`,children:`Loading diff...`})});if(d)return(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-screen bg-github-bg-primary text-center gap-2`,children:[(0,j.jsx)(`h2`,{className:`text-github-danger text-2xl mb-2`,children:`Error`}),(0,j.jsx)(`p`,{className:`text-github-text-secondary text-base`,children:d})]});if(!e)return(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-screen bg-github-bg-primary text-center gap-2`,children:[(0,j.jsx)(`h2`,{className:`text-github-danger text-2xl mb-2`,children:`No data`}),(0,j.jsx)(`p`,{className:`text-github-text-secondary text-base`,children:`No diff data available`})]});let zt=pe.editor!==`none`&&e.openInEditorAvailable!==!1;return(0,j.jsx)(Pt,{children:(0,j.jsxs)(`div`,{className:`h-screen flex flex-col`,onClickCapture:Lt,children:[(0,j.jsxs)(`header`,{className:`bg-github-bg-secondary border-b border-github-border flex ${z?`flex-col`:`flex-row items-center`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between w-full ${z?`px-3 py-2 gap-3`:`px-4 py-3 gap-4 w-auto`} ${x?``:`!transition-all !duration-300 !ease-in-out`}`,style:{width:z?`100%`:y?`${h}px`:`auto`,minWidth:z?`0px`:y?`200px`:`auto`,maxWidth:z?`none`:y?`600px`:`none`},children:[(0,j.jsx)(`h1`,{children:(0,j.jsx)(db,{style:{height:`18px`,color:`var(--color-github-text-secondary)`}})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`button`,{onClick:()=>b(!y),className:`p-2 text-github-text-secondary hover:text-github-text-primary hover:bg-github-bg-tertiary rounded transition-colors`,title:y?`Collapse file tree`:`Expand file tree`,"aria-expanded":y,"aria-controls":`file-tree-panel`,"aria-label":`Toggle file tree panel`,children:y?(0,j.jsx)(rt,{size:18}):(0,j.jsx)(it,{size:18})}),(0,j.jsx)(`button`,{onClick:()=>v(!0),className:`p-2 text-github-text-secondary hover:text-github-text-primary hover:bg-github-bg-tertiary rounded transition-colors`,title:`Settings`,children:(0,j.jsx)(ct,{size:18})})]})]}),!z&&(0,j.jsx)(`div`,{className:`border-r border-github-border ${x?``:`!transition-all !duration-300 !ease-in-out`}`,style:{width:y?`4px`:`0px`,height:`calc(100% - 16px)`,margin:`8px 0`,transform:`translateX(-2px)`}}),(0,j.jsxs)(`div`,{className:`flex-1 flex flex-wrap items-center justify-between ${z?`px-3 pb-2 gap-3`:`px-4 py-3 gap-4`}`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center ${z?`gap-2`:`gap-3`}`,children:[!z&&(0,j.jsxs)(`div`,{className:`flex bg-github-bg-tertiary border border-github-border rounded-md p-1`,children:[(0,j.jsxs)(`button`,{onClick:()=>Ue(`split`),className:`px-3 py-1.5 text-xs font-medium rounded transition-all duration-200 flex items-center gap-1.5 cursor-pointer ${i===`split`?`bg-github-bg-primary text-github-text-primary shadow-sm`:`text-github-text-secondary hover:text-github-text-primary`}`,children:[(0,j.jsx)(Be,{size:14}),`Split`]}),(0,j.jsxs)(`button`,{onClick:()=>Ue(`unified`),className:`px-3 py-1.5 text-xs font-medium rounded transition-all duration-200 flex items-center gap-1.5 cursor-pointer ${i===`unified`?`bg-github-bg-primary text-github-text-primary shadow-sm`:`text-github-text-secondary hover:text-github-text-primary`}`,children:[(0,j.jsx)(ut,{size:14}),`Unified`]})]}),(0,j.jsx)(bt,{checked:s,onChange:c,label:`Ignore Whitespace`,title:s?`Show whitespace changes`:`Ignore whitespace changes`}),(0,j.jsx)(fb,{shouldReload:ot,isReloading:lt.isReloading,onReload:st,changeType:lt.lastChangeType,compact:z})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center text-sm text-github-text-secondary ${z?`gap-3`:`gap-4`}`,children:[!z&&ge.length>0&&(0,j.jsx)(xt,{commentsCount:ge.length,isCopiedAll:p,onCopyAll:Mt,onDeleteAll:Se,onViewAll:()=>O(!0)}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1 items-center`,children:[(0,j.jsxs)(`div`,{className:`text-xs relative`,children:[Ae.size===e.files.length?`All diffs difit-ed!`:`${Ae.size} / ${e.files.length} files viewed`,(0,j.jsx)(Ub,{isActive:C})]}),(0,j.jsx)(`div`,{className:`relative h-2 bg-github-bg-tertiary rounded-full overflow-hidden`,style:{width:`90px`,border:`1px solid var(--color-github-border)`},children:(0,j.jsx)(`div`,{className:`absolute top-0 right-0 h-full transition-all duration-300 ease-out`,style:{width:`${(e.files.length-Ae.size)/e.files.length*100}%`,backgroundColor:(()=>{let t=(e.files.length-Ae.size)/e.files.length*100;return t>50?`var(--color-github-accent)`:t>20?`var(--color-github-warning)`:`var(--color-github-danger)`})()}})})]}),I?(0,j.jsx)(rc,{options:I,selection:ne,resolvedBaseRevision:L,resolvedTargetRevision:R,onSelectDiff:e=>void kt(e),onOpenAdvanced:()=>M(!0),compact:!he}):(0,j.jsxs)(`span`,{className:`text-xs`,children:[`Reviewing:`,` `,(0,j.jsx)(`code`,{className:`bg-github-bg-tertiary px-1.5 py-0.5 rounded text-xs text-github-text-primary`,children:e.commit.includes(`...`)?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`text-github-text-secondary font-medium`,children:[e.commit.split(`...`)[0],`...`]}),(0,j.jsx)(`span`,{className:`font-medium`,children:e.commit.split(`...`)[1]})]}):e.commit})]})]})]})]}),I&&(0,j.jsx)(hb,{isOpen:k,onClose:()=>M(!1),options:I,selection:ne,resolvedBaseRevision:L,resolvedTargetRevision:R,onApply:e=>void kt(e)},k?yt(ne):`closed`),z&&y&&(0,j.jsx)(`button`,{type:`button`,"aria-label":`Close file tree`,className:`fixed inset-0 bg-black/40 z-30`,onClick:()=>b(!1)}),(0,j.jsxs)(`div`,{className:`flex flex-1 overflow-hidden relative`,children:[(0,j.jsx)(`div`,{className:`relative overflow-hidden ${x?``:`!transition-all !duration-300 !ease-in-out`}`,style:{width:z?`0px`:y?`${h}px`:`0px`},children:(0,j.jsxs)(`aside`,{id:`file-tree-panel`,className:`bg-github-bg-secondary overflow-y-auto flex flex-col ${z?`fixed inset-y-0 right-0 z-40 w-[min(85vw,360px)] border-l border-github-border transition-transform duration-300 ease-out`:`relative border-r border-github-border`}`,style:{width:z?`min(85vw, 360px)`:`${h}px`,minWidth:z?`0px`:`200px`,maxWidth:z?`none`:`600px`,height:`100%`,transform:z?y?`translateX(0)`:`translateX(100%)`:void 0},children:[(0,j.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,j.jsx)(cb,{files:e.files,onScrollToFile:Le,onFileSelected:z?He:void 0,comments:Ee,reviewedFiles:Ae,onToggleReviewed:Re,selectedFileIndex:dt?.fileIndex??null})}),!z&&(0,j.jsxs)(`div`,{className:`p-4 border-t border-github-border flex justify-between items-center`,children:[(0,j.jsxs)(`button`,{onClick:()=>pt(!0),className:`flex items-center gap-1.5 text-github-text-secondary hover:text-github-text-primary transition-colors`,title:`Keyboard shortcuts (Shift+?)`,children:[(0,j.jsx)(Qe,{size:16}),(0,j.jsx)(`span`,{className:`text-sm`,children:`Shortcuts`})]}),(0,j.jsxs)(`a`,{href:`https://github.com/yoshiko-pg/difit`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-github-text-secondary hover:text-github-text-primary transition-colors`,title:`View on GitHub`,children:[(0,j.jsx)(`span`,{className:`text-sm`,children:`Star on GitHub`}),(0,j.jsx)(lb,{style:{height:`18px`,width:`18px`}})]})]})]})}),!z&&(0,j.jsx)(`div`,{className:`bg-github-border hover:bg-github-text-muted cursor-col-resize ${x?``:`!transition-all !duration-300 !ease-in-out`}`,style:{width:y?`4px`:`0px`},onMouseDown:Dt,title:`Drag to resize file list`}),(0,j.jsx)(`main`,{ref:F,className:`flex-1 overflow-y-auto ${ke?`pb-16`:``}`,children:e.files.map((t,r)=>{let a=Oe.get(t.path)??lS,o=cS(Ze,n,t.path)??uS,s=Ne.has(t.path);return(0,j.jsx)(`div`,{id:Gx(t.path),"data-file-path":t.path,"data-rendered":s?`true`:`false`,ref:e=>Ie(t.path,e),className:`mb-6`,children:s?(0,j.jsx)(tb,{file:t,threads:a,showAuthorBadges:De,diffMode:i,reviewedFiles:Ae,onToggleReviewed:Re,collapsedFiles:N,onToggleCollapsed:ze,onToggleAllCollapsed:Ve,onAddComment:jt,onGenerateThreadPrompt:Et,onRemoveThread:ye,onReplyToThread:Nt,onRemoveMessage:be,onUpdateMessage:xe,onOpenInEditor:zt?It:void 0,syntaxTheme:pe.syntaxTheme,baseCommitish:e.baseCommitish,targetCommitish:e.targetCommitish,cursor:dt?.fileIndex===r?dt:null,fileIndex:r,onLineClick:wt,commentTrigger:nt?.fileIndex===r?nt:null,onCommentTriggerHandled:Tt,mergedChunks:o,expandLines:Ge,expandAllBetweenChunks:Ke,prefetchFileContent:qe,isExpandLoading:We}):(0,j.jsx)(`div`,{className:`bg-github-bg-secondary border border-github-border rounded-md px-4 py-3`,children:(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-github-text-muted`,children:`Deferred Rendering`}),(0,j.jsx)(`div`,{className:`text-sm font-mono text-github-text-primary truncate`,children:t.path})]}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>Pe(t.path),className:`px-3 py-1.5 text-xs rounded border border-github-border text-github-text-secondary hover:text-github-text-primary hover:bg-github-bg-tertiary`,children:`Load now`})]})})},t.path)})})]}),ke&&(0,j.jsx)(`div`,{className:`fixed bottom-0 left-0 right-0 z-20 bg-github-bg-secondary border-t border-github-border px-4 py-2 flex justify-end`,children:(0,j.jsx)(xt,{commentsCount:ge.length,isCopiedAll:p,onCopyAll:Mt,onDeleteAll:Se,onViewAll:()=>O(!0),direction:`up`,compact:!0})}),_&&(0,j.jsx)(Vb,{isOpen:_,onClose:()=>v(!1),settings:pe,onSettingsChange:me}),(0,j.jsx)(ub,{isOpen:ft,onClose:()=>pt(!1)}),(0,j.jsx)(dr,{isOpen:D,onClose:()=>O(!1),onNavigate:Ft,comments:Ee,showAuthorBadges:De,onRemoveThread:ye,onGenerateThreadPrompt:Et,onReplyToThread:Nt,onRemoveMessage:be,onUpdateMessage:xe,syntaxTheme:pe.syntaxTheme})]})})}var yS=document.getElementById(`root`);if(!yS)throw Error(`Root element not found`);k.createRoot(yS).render((0,j.jsx)(A.StrictMode,{children:(0,j.jsx)(_e,{initiallyActiveScopes:[`navigation`],children:(0,j.jsx)(vS,{})})}));
78
+ `);return`${e.path}\n${e.status}\n${t}`}function yx(e){return{id:e.id,file:e.filePath,line:typeof e.position.line==`number`?e.position.line:[e.position.line.start,e.position.line.end],side:e.position.side,createdAt:e.createdAt,updatedAt:e.updatedAt,codeContent:e.codeSnapshot?.content,messages:e.messages}}function bx(e){let t=e.messages[0];return t?{id:e.id,filePath:e.filePath,body:t.body,author:t.author,createdAt:t.createdAt,updatedAt:t.updatedAt,position:e.position,codeSnapshot:e.codeSnapshot}:null}function xx(e,t,n,r,i,a){let[o,s]=(0,A.useState)([]),c=(0,A.useCallback)(()=>!e||!t?null:hx.getDiffContextData(e,t,n,r,i,a),[e,t,n,r,i,a]),l=(0,A.useCallback)(()=>{if(!e||!t)return null;let n=new Date().toISOString();return{version:2,baseCommitish:e,targetCommitish:t,baseMode:a,createdAt:n,lastModifiedAt:n,threads:[],viewedFiles:[],appliedCommentImportIds:[]}},[e,t,a]);(0,A.useEffect)(()=>{!e||!t||s(c()?.threads||hx.getCommentThreads(e,t,n,r,i,a))},[e,t,n,r,i,a,c]);let u=(0,A.useCallback)(o=>{!e||!t||(hx.saveCommentThreads(e,t,o,n,r,i,a),s(o))},[e,t,n,r,i,a]),d=(0,A.useCallback)(e=>{let t=new Date().toISOString(),n=ex(),r={id:n,filePath:e.filePath,createdAt:t,updatedAt:t,position:{side:e.side,line:e.line},codeSnapshot:e.codeSnapshot||{content:``,language:Gn(e.filePath)},messages:[{id:n,body:e.body,author:`User`,createdAt:t,updatedAt:t}]};return u([...o,r]),r},[u,o]),f=(0,A.useCallback)(e=>{let t=bx(d(e));if(!t)throw Error(`Failed to create root comment`);return t},[d]),p=(0,A.useCallback)(({threadId:e,body:t})=>{let n=new Date().toISOString();u(o.map(r=>r.id===e?{...r,updatedAt:n,messages:[...r.messages,{id:ex(),body:t,author:`User`,createdAt:n,updatedAt:n}]}:r))},[u,o]),m=(0,A.useCallback)(e=>{u(o.filter(t=>t.id!==e))},[u,o]),h=(0,A.useCallback)(e=>{m(e)},[m]),g=(0,A.useCallback)((e,t)=>{let n=o.find(t=>t.id===e);if(!n)return;let r=n.messages.findIndex(e=>e.id===t);if(r<0)return;if(r===0){m(e);return}let i=new Date().toISOString();u(o.map(n=>n.id===e?{...n,updatedAt:i,messages:n.messages.filter(e=>e.id!==t)}:n))},[m,u,o]),_=(0,A.useCallback)((e,t,n)=>{let r=new Date().toISOString();u(o.map(i=>i.id===e?{...i,updatedAt:r,messages:i.messages.map(e=>e.id===t?{...e,body:n,updatedAt:r}:e)}:i))},[u,o]),v=(0,A.useCallback)((e,t)=>{_(e,e,t)},[_]),y=(0,A.useCallback)(()=>{u([])},[u]),b=(0,A.useCallback)(o=>{if(!o?.resetAppliedCommentImportIds){y();return}let u=c()||l();if(!u||!e||!t)return;let d={...u,threads:[],appliedCommentImportIds:[]};hx.saveDiffContextData(e,t,d,n,r,i,a),s([])},[e,t,r,y,l,n,c,i,a]),x=(0,A.useCallback)((o,u)=>{if(!e||!t||o.length===0||u.length===0)return[];let d=c()||l();if(!d)return[];if(d.appliedCommentImportIds.includes(u))return s(d.threads),[];let f=dx(d.threads,o),p={...d,threads:f.threads,appliedCommentImportIds:[...d.appliedCommentImportIds,u]};return hx.saveDiffContextData(e,t,p,n,r,i,a),s(f.threads),f.warnings},[e,t,r,l,n,c,i,a]),S=(0,A.useCallback)(e=>{let t=o.find(t=>t.id===e);return t?Xb(yx(t)):``},[o]),C=(0,A.useCallback)(e=>S(e),[S]),w=(0,A.useCallback)(()=>Zb(o.map(yx)),[o]);return{comments:o.map(e=>bx(e)).filter(e=>e!==null),threads:o,addComment:f,addThread:d,removeComment:h,replyToThread:p,removeThread:m,updateComment:v,removeMessage:g,updateMessage:_,clearAllComments:b,applyCommentImports:x,generatePrompt:C,generateThreadPrompt:S,generateAllCommentsPrompt:w}}var Sx=20;async function Cx(e,t){let n=await fetch(`/api/blob/${encodeURIComponent(e)}?ref=${encodeURIComponent(t)}`);if(!n.ok)throw Error(`Failed to fetch file content: ${n.statusText}`);let r=(await n.text()).split(`
79
+ `);return r.length>0&&r[r.length-1]===``&&r.pop(),{lines:r,totalLines:r.length}}async function wx(e,t,n,r){let i=encodeURIComponent(e),a=new URLSearchParams;t&&a.set(`oldRef`,t),n&&a.set(`newRef`,n),r&&r!==e&&a.set(`oldPath`,r);let o=await fetch(`/api/line-count/${i}?${a}`);if(!o.ok)throw Error(`Failed to fetch line count: ${o.statusText}`);return o.json()}function Tx({baseCommitish:e,targetCommitish:t,diffIdentity:n}){let[r,i]=(0,A.useState)({}),[a,o]=(0,A.useState)(!1),[s,c]=(0,A.useState)(null),[l,u]=(0,A.useState)(0),d=(0,A.useRef)(new Map),f=(0,A.useRef)({});f.current=r;let p=(0,A.useRef)(0);(0,A.useEffect)(()=>{p.current+=1,d.current.clear(),f.current={},i({}),o(!1),c(null),u(0)},[e,t,n]);let m=(0,A.useCallback)(async n=>{let r=p.current,i=`${r}:${n.path}`,a=d.current.get(i);if(a)return a;let o=(async()=>{let i=f.current[n.path];if(i?.oldContent&&i?.newContent)return i;let a={...i,expandedRanges:i?.expandedRanges||[]};if(n.status!==`added`&&e){let t=n.oldPath||n.path;try{let{lines:n,totalLines:i}=await Cx(t,e);if(p.current!==r)return null;a.oldContent=n,a.oldTotalLines=i}catch(e){console.error(`Failed to fetch old file content:`,e),a.oldContent=[],a.oldTotalLines=0}}if(n.status!==`deleted`&&t)try{let{lines:e,totalLines:i}=await Cx(n.path,t);if(p.current!==r)return null;a.newContent=e,a.newTotalLines=i}catch(e){console.error(`Failed to fetch new file content:`,e),a.newContent=[],a.newTotalLines=0}return a})();d.current.set(i,o);try{return await o}finally{d.current.delete(i)}},[e,t]),h=(0,A.useCallback)(e=>{c(e),u(e=>e+1)},[]),g=(0,A.useCallback)(async(e,t,n,r=Sx)=>{let a=p.current;o(!0);try{let o=await m(e);if(!o||p.current!==a)return;i(i=>{let a=i[e.path],s=a?.expandedRanges||o.expandedRanges||[],c=s.findIndex(e=>e.chunkIndex===t&&e.direction===n),l=[...s];if(c>=0&&l[c]){let e=l[c];l[c]={chunkIndex:e.chunkIndex,direction:e.direction,count:e.count+r}}else l.push({chunkIndex:t,direction:n,count:r});return{...i,[e.path]:{oldContent:a?.oldContent??o.oldContent,newContent:a?.newContent??o.newContent,oldTotalLines:a?.oldTotalLines??o.oldTotalLines,newTotalLines:a?.newTotalLines??o.newTotalLines,expandedRanges:l}}}),h(e.path)}finally{o(!1)}},[m,h]),_=(0,A.useCallback)(async(e,t,n)=>{let r=p.current;o(!0);try{let a=await m(e);if(!a||p.current!==r)return;i(r=>{let i=r[e.path],o=[...i?.expandedRanges||a.expandedRanges||[]],s=o.findIndex(e=>e.chunkIndex===t&&e.direction===`up`),c=o.findIndex(e=>e.chunkIndex===t-1&&e.direction===`down`),l=0,u=0;s>=0&&o[s]&&(l=o[s].count),c>=0&&o[c]&&(u=o[c].count);let d=l+u+n,f=o.filter(e=>!(e.chunkIndex===t-1&&e.direction===`down`)),p=f.findIndex(e=>e.chunkIndex===t&&e.direction===`up`);return p>=0&&f[p]?f[p]={chunkIndex:t,direction:`up`,count:d}:f.push({chunkIndex:t,direction:`up`,count:d}),{...r,[e.path]:{oldContent:i?.oldContent??a.oldContent,newContent:i?.newContent??a.newContent,oldTotalLines:i?.oldTotalLines??a.oldTotalLines,newTotalLines:i?.newTotalLines??a.newTotalLines,expandedRanges:f}}}),h(e.path)}finally{o(!1)}},[m,h]),v=(0,A.useCallback)(async n=>{let r=p.current,a=f.current[n.path];if(a?.oldTotalLines!==void 0||a?.newTotalLines!==void 0)return;let o=n.status===`added`?void 0:e,s=n.status===`deleted`?void 0:t;if(!(!o&&!s))try{let{oldLineCount:e,newLineCount:t}=await wx(n.path,o,s,n.oldPath);if(p.current!==r)return;i(r=>{let i=r[n.path];return i?.oldTotalLines!==void 0||i?.newTotalLines!==void 0?r:{...r,[n.path]:{...i,expandedRanges:i?.expandedRanges||[],oldTotalLines:e,newTotalLines:t}}}),h(n.path)}catch(e){console.error(`Failed to prefetch line count:`,e)}},[e,t,h]),y=(0,A.useCallback)((e,t,n)=>{let i=r[e];return i&&i.expandedRanges.find(e=>e.chunkIndex===t&&e.direction===n)?.count||0},[r]),b=(0,A.useCallback)((e,t,n)=>{if(e.status===`added`||e.status===`deleted`)return 0;let r=e.chunks[n-1],i;if(!r)i=t.oldStart-1;else{let e=r.oldStart+r.oldLines;i=t.oldStart-e}let a=y(e.path,n,`up`),o=n>0?y(e.path,n-1,`down`):0;return Math.max(0,i-a-o)},[y]),x=(0,A.useCallback)((e,t,n)=>{if(e.status===`added`||e.status===`deleted`)return 0;let i=r[e.path],a=i?.oldTotalLines||i?.newTotalLines;if(a===void 0)return e.chunks[n+1]?0:-1;if(e.chunks[n+1])return 0;let o=a-(t.oldStart+t.oldLines-1),s=y(e.path,n,`down`);return Math.max(0,o-s)},[r,y]),S=(0,A.useCallback)((e,t,n)=>{let i=r[e.path];if(!i)return t;let a=y(e.path,n,`up`),o=y(e.path,n,`down`);if(a===0&&o===0)return t;let s=i.oldContent||[],c=i.newContent||[],l=[];if(a>0){let r=e.chunks[n-1],i;i=r?r.oldStart+r.oldLines-1:Math.max(0,t.oldStart-1-a);let o=t.oldStart-1,u=t.newStart-1,d=Math.min(a,o-i),f=o-d,p=u-d;for(let e=0;e<d;e++){let t=f+e+1,n=p+e+1,r=s[t-1]??c[n-1]??``;l.push({type:`normal`,content:r,oldLineNumber:t,newLineNumber:n,isExpanded:!0})}}if(l.push(...t.lines),o>0){let r=t.oldStart+t.oldLines-1,a=t.newStart+t.newLines-1,u=e.chunks[n+1],d=u?u.oldStart-1:i.oldTotalLines||r,f=Math.min(o,d-r);for(let e=0;e<f;e++){let t=r+e+1,n=a+e+1,i=s[t-1]??c[n-1]??``;l.push({type:`normal`,content:i,oldLineNumber:t,newLineNumber:n,isExpanded:!0})}}let u=l[0],d=l[l.length-1];return{...t,lines:l,oldStart:u?.oldLineNumber??t.oldStart,newStart:u?.newLineNumber??t.newStart,oldLines:(d?.oldLineNumber??t.oldStart+t.oldLines-1)-(u?.oldLineNumber??t.oldStart)+1,newLines:(d?.newLineNumber??t.newStart+t.newLines-1)-(u?.newLineNumber??t.newStart)+1}},[r,y]);return{expandedState:r,isLoading:a,lastUpdatedFilePath:s,lastUpdatedAt:l,expandLines:g,expandAllBetweenChunks:_,prefetchFileContent:v,getMergedChunks:(0,A.useCallback)(e=>{let t=[];for(let n=0;n<e.chunks.length;n++){let r=e.chunks[n];if(!r)continue;let i=S(e,r,n),a=b(e,r,n),o=x(e,r,n),s=t[t.length-1];if(s&&a===0){s.lines=[...s.lines,...i.lines],s.originalIndices.push(n),s.hiddenLinesAfter=o;let e=s.lines[s.lines.length-1];s.oldLines=(e?.oldLineNumber??s.oldStart+s.oldLines-1)-s.oldStart+1,s.newLines=(e?.newLineNumber??s.newStart+s.newLines-1)-s.newStart+1}else t.push({...i,originalIndices:[n],hiddenLinesBefore:a,hiddenLinesAfter:o})}return t},[S,b,x]),getHiddenLinesBefore:b,getHiddenLinesAfter:x}}var Ex=function(e){return e.DEFAULT=`default`,e.WORKING=`working`,e.STAGED=`staged`,e.DOT=`dot`,e.SPECIFIC=`specific`,e}({});function Dx(e){let t=(void 0)?.trim();if(!t)return e;try{return new URL(e,t).toString()}catch{return e}}function Ox(e){let t=(0,A.useRef)(null),n=(0,A.useRef)(null),r=(0,A.useRef)(0),i=3e3,[a,o]=(0,A.useState)({isWatchEnabled:!1,diffMode:Ex.DEFAULT,shouldReload:!1,isReloading:!1,lastChangeTime:null,lastChangeType:null,connectionStatus:`disconnected`}),[s,c]=(0,A.useState)(null),l=(0,A.useCallback)(()=>{if(!t.current)try{let e=new EventSource(Dx(`/api/watch`));t.current=e,e.onopen=()=>{console.log(`Connected to file watch service`),o(e=>({...e,connectionStatus:`connected`})),r.current=0,c(null)},e.onmessage=e=>{try{let t=JSON.parse(e.data);switch(t.type){case`connected`:o(e=>({...e,isWatchEnabled:!0,diffMode:t.diffMode,connectionStatus:`connected`}));break;case`reload`:console.log(`File changes detected, showing reload button:`,t.changeType),o(e=>({...e,shouldReload:!0,lastChangeTime:new Date,lastChangeType:t.changeType}));break;case`error`:console.error(`File watch error:`,t.message),c(t.message||`File watch error occurred`);break}}catch(e){console.error(`Error parsing watch event:`,e)}},e.onerror=()=>{console.log(`File watch connection lost`),o(e=>({...e,connectionStatus:`disconnected`})),t.current&&=(t.current.close(),null),r.current<5?(o(e=>({...e,connectionStatus:`reconnecting`})),r.current+=1,n.current=setTimeout(()=>{console.log(`Attempting to reconnect to file watch service (${r.current}/5)...`),l()},i)):(console.error(`Max reconnection attempts reached`),c(`Lost connection to file watch service`))}}catch(e){console.error(`Failed to connect to file watch service:`,e),c(`Failed to connect to file watch service`)}},[5,i]),u=(0,A.useCallback)(async()=>{if(!a.isReloading){o(e=>({...e,isReloading:!0}));try{e&&await e(),o(e=>({...e,shouldReload:!1,isReloading:!1,lastChangeTime:null,lastChangeType:null}))}catch(e){console.error(`Reload failed:`,e),c(`Failed to reload diff data`),o(e=>({...e,isReloading:!1}))}}},[e,a.isReloading]),d=()=>{t.current&&=(t.current.close(),null),n.current&&=(clearTimeout(n.current),null)};return(0,A.useEffect)(()=>(l(),d),[l]),(0,A.useEffect)(()=>d,[]),{shouldReload:a.shouldReload,isConnected:a.connectionStatus===`connected`,error:s,reload:u,watchState:a}}var kx={SCROLL_CONTAINER:`main.overflow-y-auto`};function Ax(e,t){let n=`file-${e.fileIndex}-chunk-${e.chunkIndex}-line-${e.lineIndex}`;return t===`split`?`${n}-${e.side}`:n}function jx(e,t,n){return`${e}:${t}:${n??`any`}`}function Mx(e,t){let n=t[e.fileIndex]?.chunks[e.chunkIndex]?.lines[e.lineIndex];return n&&(n.type===`add`||n.type===`delete`||n.type===`normal`)?n.type:null}function Nx(e,t){let n=Mx(e,t);return n?n===`normal`?!0:n===`delete`?e.side===`left`:n===`add`?e.side===`right`:!1:!1}function Px(e,t){return Nx(e,t)?e:{...e,side:e.side===`left`?`right`:`left`}}var Fx={VIEWPORT_OFFSET_RATIO:1/3};function Ix(e,t,n){let r=[];return t.oldLineNumber!==void 0&&(r.push(jx(e,t.oldLineNumber,`old`)),r.push(jx(e,t.oldLineNumber))),t.newLineNumber!==void 0&&(r.push(jx(e,t.newLineNumber,`new`)),r.push(jx(e,t.newLineNumber))),r.some(e=>n.has(e))}function Lx(e,t,n,r){return{line:t=>{let i=e[t.fileIndex];return!i||r?.has(i.path)?!1:n===`unified`||Nx(t,e)},chunk:t=>{let n=e[t.fileIndex];if(!n||r?.has(n.path))return!1;let i=n.chunks[t.chunkIndex]?.lines[t.lineIndex];if(!i||i.type===`normal`)return!1;if(t.lineIndex===0)return!0;let a=n.chunks[t.chunkIndex]?.lines[t.lineIndex-1];return!a||a.type===`normal`},comment:n=>{let i=e[n.fileIndex];if(!i||r?.has(i.path))return!1;let a=i.chunks[n.chunkIndex]?.lines[n.lineIndex];return a?Ix(i.path,a,t):!1},file:e=>e.chunkIndex===0&&e.lineIndex===0}}function Rx(){return e=>{let t=document.getElementById(e);if(!t)return;let n=document.querySelector(kx.SCROLL_CONTAINER);if(!n)throw Error(`Scrollable container (${kx.SCROLL_CONTAINER}) not found`);let r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=n.clientHeight,o=n.scrollTop,s=Math.max(i.top,0),c=Math.min(i.bottom,window.innerHeight);if(!(r.top>=s&&r.bottom<=c)){let e=zx(t,n)-a*Fx.VIEWPORT_OFFSET_RATIO;n.scrollTop=Math.max(0,e);return}let l=r.bottom>Math.min(i.bottom,window.innerHeight),u=t.offsetTop-n.offsetTop-a*Fx.VIEWPORT_OFFSET_RATIO;l&&u>o&&(n.scrollTop=Math.max(0,u))}}function zx(e,t){let n=e,r=0;for(;n&&n!==t&&n.offsetParent;)r+=n.offsetTop,n=n.offsetParent;return n&&n!==t&&(r+=n.offsetTop),r}function Bx(e){return e||{fileIndex:0,chunkIndex:0,lineIndex:-1,side:`right`}}function Vx(e,t,n){return n&&e.fileIndex===t.fileIndex&&e.chunkIndex===t.chunkIndex&&e.lineIndex===t.lineIndex}function Hx(e,t,n){let{fileIndex:r,chunkIndex:i,lineIndex:a}=e,o=n.length,s=0;if(t===`next`)for(a++;s<o;){if(n[r]?.chunks[i]?.lines[a])return{...e,fileIndex:r,chunkIndex:i,lineIndex:a};i++,a=0,n[r]?.chunks[i]||(r++,i=0,a=0,r>=o&&(r=0,s++))}else for(a--;s<o;){if(a<0)if(i--,i<0){r--,r<0&&(r=o-1,s++);let e=n[r];if(e&&e.chunks.length>0){i=e.chunks.length-1;let t=e.chunks[i];a=t&&t.lines.length>0?t.lines.length-1:-1}else i=-1,a=-1}else{let e=n[r]?.chunks[i];a=e&&e.lines.length>0?e.lines.length-1:-1}if(a>=0&&n[r]?.chunks[i]?.lines[a])return{...e,fileIndex:r,chunkIndex:i,lineIndex:a};a<0||a--}return null}function Ux(e,t,n,r,i){let a=e,o=!1;for(;a;){let s=Hx(a,t,r);if(!s||(a=s,Vx(a,e,o)))break;if(o=!0,n(a,r)){let e=Px(a,r);return{position:e,scrollTarget:Ax(e,i)}}}return{position:null,scrollTarget:null}}function Wx({files:e,comments:t,viewMode:n=mt,reviewedFiles:r,onToggleReviewed:i,onCreateComment:a,onCopyAllComments:o,onDeleteAllComments:s,onShowCommentsList:c,onRefresh:l}){let[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(!1),m=(0,A.useMemo)(()=>Rx(),[]),h=(0,A.useMemo)(()=>{let e=new Map;return t.forEach(t=>{let n=Array.isArray(t.line)?t.line[0]:t.line,r=jx(t.file,n,t.side);e.has(r)||e.set(r,[]),e.get(r)?.push(t)}),e},[t]),g=(0,A.useMemo)(()=>Lx(e,h,n,r),[e,h,n,r]),_=(0,A.useCallback)((t,r)=>e.length===0?{position:null,scrollTarget:null}:Ux(Bx(u),t,r,e,n),[u,e,n]),v=(0,A.useCallback)(e=>t=>{let n=_(t,e);n.position&&(d(n.position),n.scrollTarget&&m(n.scrollTarget))},[_,m]),y=(0,A.useMemo)(()=>v(g.line),[v,g.line]),b=(0,A.useMemo)(()=>v(g.chunk),[v,g.chunk]),x=(0,A.useMemo)(()=>v(g.file),[v,g.file]),S=(0,A.useMemo)(()=>v(g.comment),[v,g.comment]),C=(0,A.useCallback)(t=>{if(!u||n!==`split`)return;let r={...u,side:t},i=e[u.fileIndex]?.chunks[u.chunkIndex]?.lines[u.lineIndex];if(i){if(t===`left`&&i.type===`add`&&u.lineIndex>0){if(e[u.fileIndex]?.chunks[u.chunkIndex]?.lines[u.lineIndex-1]?.type===`delete`){r={...r,lineIndex:u.lineIndex-1},d(r),m(Ax(r,n));return}}else if(t===`right`&&i.type===`delete`&&e[u.fileIndex]?.chunks[u.chunkIndex]?.lines[u.lineIndex+1]?.type===`add`){r={...r,lineIndex:u.lineIndex+1},d(r),m(Ax(r,n));return}}if(!Nx(r,e)){let t=e[u.fileIndex];if(!t)return;let n=t.chunks[u.chunkIndex];if(n){for(let t=u.lineIndex+1;t<n.lines.length;t++){let n={...r,lineIndex:t};if(Nx(n,e)){r=n;break}}if(!Nx(r,e))for(let t=u.lineIndex-1;t>=0;t--){let n={...r,lineIndex:t};if(Nx(n,e)){r=n;break}}}if(!Nx(r,e)){for(let n=u.chunkIndex+1;n<t.chunks.length;n++){let i=t.chunks[n];if(i){for(let t=0;t<i.lines.length;t++){let i={...r,chunkIndex:n,lineIndex:t};if(Nx(i,e)){r=i;break}}if(Nx(r,e))break}}if(!Nx(r,e))for(let n=u.chunkIndex-1;n>=0;n--){let i=t.chunks[n];if(i){for(let t=i.lines.length-1;t>=0;t--){let i={...r,chunkIndex:n,lineIndex:t};if(Nx(i,e)){r=i;break}}if(Nx(r,e))break}}}}d(r),m(Ax(r,n))},[u,n,m,e]),w=(0,A.useCallback)(()=>{let t=document.querySelector(kx.SCROLL_CONTAINER);if(!t)return;let r=t.getBoundingClientRect(),i=r.top+r.height/2,a=1/0,o=null;e.forEach((t,s)=>{t.chunks.forEach((t,c)=>{t.lines.forEach((t,l)=>{let u=n===`split`?[`left`,`right`]:[`right`];for(let t of u){let u={fileIndex:s,chunkIndex:c,lineIndex:l,side:t};if(n===`split`&&!Nx(u,e))continue;let d=Ax(u,n),f=document.getElementById(d);if(f){let e=f.getBoundingClientRect(),t=e.top+e.height/2,n=Math.abs(t-i);e.top<r.bottom&&e.bottom>r.top&&n<a&&(a=n,o=u)}}})})}),o&&d(o)},[e,n,d]),T=(0,A.useCallback)(t=>{if(!t){d(null);return}let r=Px(t,e);d(r),m(Ax(r,n))},[e,n,m]),E={scopes:`navigation`,enableOnFormTags:!1,preventDefault:!0};return xe(`j, down`,()=>y(`next`),E,[y]),xe(`k, up`,()=>y(`prev`),E,[y]),xe(`n`,()=>b(`next`),E,[b]),xe(`p`,()=>b(`prev`),E,[b]),xe(`shift+n`,()=>S(`next`),E,[S]),xe(`shift+p`,()=>S(`prev`),E,[S]),xe(`]`,()=>x(`next`),{...E,useKey:!0},[x]),xe(`[`,()=>x(`prev`),{...E,useKey:!0},[x]),xe(`{`,()=>{e.length>0&&(d({fileIndex:0,chunkIndex:0,lineIndex:0,side:n===`split`?`left`:`right`}),m(Ax({fileIndex:0,chunkIndex:0,lineIndex:0,side:n===`split`?`left`:`right`},n)))},{...E,useKey:!0},[e,n,m]),xe(`}`,()=>{if(e.length>0){let t=e.length-1,r=e[t];r&&r.chunks.length>0&&(d({fileIndex:t,chunkIndex:0,lineIndex:0,side:n===`split`?`left`:`right`}),m(Ax({fileIndex:t,chunkIndex:0,lineIndex:0,side:n===`split`?`left`:`right`},n)))}},{...E,useKey:!0},[e,n,m]),xe(`h, left`,()=>C(`left`),{...E,enabled:n===`split`},[C,n]),xe(`l, right`,()=>C(`right`),{...E,enabled:n===`split`},[C,n]),xe(`v`,()=>{if(u){let t=e[u.fileIndex];t&&i(t.path)}},E,[u,e,i]),xe(`shift+r`,()=>{l&&l()},E,[l]),xe(`c`,()=>{if(u&&a){let t=e[u.fileIndex]?.chunks[u.chunkIndex]?.lines[u.lineIndex];t&&t.type!==`delete`&&a()}},E,[u,e,a]),xe(`?`,()=>p(!f),{...E,useKey:!0},[f]),xe(`.`,e=>{e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||(w(),e.preventDefault())},{...E,useKey:!0,preventDefault:!1},[w]),xe(`shift+c`,()=>{o&&o()},{...E,scopes:[`navigation`,`comments-list`]},[o]),xe(`shift+d`,()=>{s&&s()},{...E,scopes:[`navigation`,`comments-list`]},[s]),xe(`shift+l`,()=>{c&&c()},E,[c]),{cursor:u,isHelpOpen:f,setIsHelpOpen:p,setCursorPosition:T}}var Gx=new Map,Kx=0;function qx(e){return Gx.has(e)||Gx.set(e,`file-${++Kx}`),Gx.get(e)??``}var Jx=8,Yx=`1200px 0px`,Xx=60,Zx=180;function Qx({diffData:e,diffScrollContainerRef:t,setDiffData:n}){let[r,i]=(0,A.useState)(new Set),a=(0,A.useRef)(new Set),o=(0,A.useRef)(null),s=(0,A.useRef)(new Map),c=(0,A.useRef)(new Set),l=(0,A.useRef)(null),u=(0,A.useRef)(0);(0,A.useEffect)(()=>{if(!e){let e=new Set;a.current=e,i(e),c.current.clear(),l.current=null;return}let t=`${e.requestedBaseCommitish??``}:${e.requestedTargetCommitish??``}:${e.requestedBaseMode??`direct`}`;if(l.current===t)return;l.current=t;let n=e.files.slice(0,Jx).map(e=>e.path),r=new Set(n);a.current=r,i(r),c.current.clear()},[e]);let d=(0,A.useCallback)(e=>{let t=s.current.get(e);t&&o.current&&o.current.unobserve(t),i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),a.current=n,n})},[]),f=(0,A.useCallback)((e,t)=>{let n=o.current,r=s.current.get(e);if(r&&n&&n.unobserve(r),!t){s.current.delete(e);return}s.current.set(e,t),!(a.current.has(e)||!n)&&n.observe(t)},[]);(0,A.useEffect)(()=>{if(o.current&&o.current.disconnect(),!e){o.current=null;return}let n=new IntersectionObserver(e=>{i(t=>{let r=!1,i=new Set(t);return e.forEach(e=>{if(!e.isIntersecting)return;let t=e.target.dataset.filePath;!t||i.has(t)||(i.add(t),n.unobserve(e.target),r=!0)}),r&&(a.current=i),r?i:t})},{root:t.current,rootMargin:Yx});return o.current=n,s.current.forEach((e,t)=>{a.current.has(t)||n.observe(e)}),()=>{n.disconnect(),o.current=null}},[e,t]);let p=(0,A.useCallback)(t=>{if(!e)return;let n=e.files.findIndex(e=>e.path===t);if(n<0)return;let r=o.current;i(t=>{let i=!1,o=new Set(t);for(let t=0;t<=n;t++){let n=e.files[t]?.path;if(n&&!o.has(n)){o.add(n),i=!0;let e=s.current.get(n);e&&r&&r.unobserve(e)}}return i&&(a.current=o),i?o:t})},[e]),m=(0,A.useCallback)(n=>{p(n);let r=e?.files.findIndex(e=>e.path===n)??-1,i=e&&r>=0?e.files.slice(0,r+1).map(e=>qx(e.path)):[qx(n)],a=u.current+1;u.current=a;let o=()=>{for(let e of i){let t=document.getElementById(e);if(!t||t.dataset.rendered!==`true`)return!1}return!0},s=e=>{let r=t.current,i=document.getElementById(qx(n));if(!r||!i)return!1;let a=r.getBoundingClientRect(),o=i.getBoundingClientRect(),s=r.scrollTop+(o.top-a.top);return r.scrollTo({top:Math.max(0,s),behavior:e}),!0},c=0,l=()=>{requestAnimationFrame(()=>{if(u.current===a){if(!o()){c<Xx&&(c++,l());return}if(!s(`smooth`)){c<Xx&&(c++,l());return}window.setTimeout(()=>{u.current===a&&s(`smooth`)},Zx)}})};l()},[e,t,p]);return(0,A.useEffect)(()=>{if(!e||e.targetCommitish===`stdin`)return;let t=e.targetCommitish||`HEAD`,i=`${e.requestedBaseCommitish??``}...${e.requestedTargetCommitish??``}:${e.requestedBaseMode??`direct`}`;e.files.forEach(a=>{if(!r.has(a.path)||a.isGenerated!==!1||a.status===`deleted`)return;let o=`${i}:${t}:${a.path}`;if(c.current.has(o))return;c.current.add(o);let s=encodeURIComponent(a.path);fetch(`/api/generated-status/${s}?ref=${encodeURIComponent(t)}`).then(e=>e.ok?e.json():null).then(t=>{!t||t.isGenerated!==!0||n(t=>{if(!t||t.requestedBaseCommitish!==e.requestedBaseCommitish||t.requestedTargetCommitish!==e.requestedTargetCommitish||t.requestedBaseMode!==e.requestedBaseMode)return t;let n=!1,r=t.files.map(e=>e.path!==a.path||e.isGenerated?e:(n=!0,{...e,isGenerated:!0}));return n?{...t,files:r}:t})}).catch(()=>{})})},[e,r,n]),{renderedFilePaths:r,ensureFileRendered:d,ensureFilesRenderedUpTo:p,registerLazyFileContainer:f,scrollFileIntoDiffContainer:m}}function $x(e,t,n,r,i,a,o=[],s){let[c,l]=(0,A.useState)([]),[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(new Map),m=e&&t?`${a??`default`}:${yt({baseCommitish:e,targetCommitish:t,baseMode:s})}:${n??`no-commit`}`:null,h=m!==null&&u===m;(0,A.useEffect)(()=>{if(!e||!t||!m)return;let c=!1,u=hx.getViewedFiles(e,t,n,r,a,s);return(async()=>{if(i&&i.length>0){let f=[],p=new Set(u.map(e=>e.filePath));for(let e of i)if((e.isGenerated||e.status===`deleted`||Ab(e.path,o))&&!p.has(e.path))try{let t=await gx(vx(e)),n={filePath:e.path,viewedAt:new Date().toISOString(),diffContentHash:t};f.push(n)}catch(e){console.error(`Failed to generate hash for auto-collapsed file:`,e)}if(f.length>0){let i=[...u,...f];hx.saveViewedFiles(e,t,i,n,r,a,s),c||(l(i),d(m));return}}c||(l(u),d(m))})(),()=>{c=!0}},[e,t,n,r,a,m,s]);let g=(0,A.useCallback)(i=>{!e||!t||(hx.saveViewedFiles(e,t,i,n,r,a,s),l(i))},[e,t,n,r,a,s]),_=(0,A.useMemo)(()=>new Set(c.map(e=>e.filePath)),[c]),v=(0,A.useCallback)(e=>c.find(t=>t.filePath===e),[c]),y=(0,A.useCallback)(async e=>{let t=f.get(e.path);if(t)return t;let n=await gx(vx(e));return p(t=>new Map(t).set(e.path,n)),n},[f]),b=(0,A.useCallback)(async(e,t)=>{let n=v(e);if(!n)return!1;let r=await y(t);return n.diffContentHash!==r},[v,y]);return{viewedFiles:_,hasLoadedInitialViewedFiles:h,toggleFileViewed:(0,A.useCallback)(async(e,t)=>{if(v(e))g(c.filter(t=>t.filePath!==e));else{let n=await y(t),r={filePath:e,viewedAt:new Date().toISOString(),diffContentHash:n};g([...c,r])}},[c,v,y,g]),isFileContentChanged:b,getViewedFileRecord:v,clearViewedFiles:(0,A.useCallback)(()=>{g([]),p(new Map)},[g])}}var eS={mobileMax:767,desktopMin:1024},tS={mobile:`(max-width: ${eS.mobileMax}px)`,desktop:`(min-width: ${eS.desktopMin}px)`},nS=()=>typeof window>`u`?{isMobile:!1,isDesktop:!0}:{isMobile:window.matchMedia(tS.mobile).matches,isDesktop:window.matchMedia(tS.desktop).matches};function rS(){let[e,t]=(0,A.useState)(()=>nS());return(0,A.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(tS.mobile),n=window.matchMedia(tS.desktop),r=()=>{t({isMobile:e.matches,isDesktop:n.matches})};return r(),e.addEventListener(`change`,r),n.addEventListener(`change`,r),()=>{e.removeEventListener(`change`,r),n.removeEventListener(`change`,r)}},[]),e}function iS(e){let t=new Set;return e.forEach(e=>{let n=e.author?.trim();n&&t.add(n)}),[...t]}function aS(e){return iS(e).length>=2}function oS(e,t,n,r){for(let i=0;i<e.chunks.length;i++){let a=e.chunks[i];if(a)for(let e=0;e<a.lines.length;e++){let o=a.lines[e];if(o&&(r===`old`?o.oldLineNumber:r===`new`?o.newLineNumber:o.newLineNumber??o.oldLineNumber)===n)return{fileIndex:t,chunkIndex:i,lineIndex:e,side:r===`old`?`left`:r===`new`||o.newLineNumber?`right`:`left`}}}return null}function sS(e,t){let n=t.findIndex(t=>t.path===e.file);if(n===-1)return null;let r=t[n];if(!r)return null;let i=Array.isArray(e.line)?e.line[1]:e.line,a=e.side;return oS(r,n,i,a)||oS(r,n,i,`new`)||oS(r,n,i,`old`)}var cS={diffVersion:null,byFile:new Map};function lS(e,t,n,r){let i=new Map;return t.forEach(e=>{let t=n.get(e);t&&i.set(e,r(t))}),{diffVersion:e,byFile:i}}function uS(e,t,n){if(e.diffVersion===t)return e.byFile.get(n)}var dS=[],fS=[],pS=`difit.sidebarWidth`,mS=`difit.sidebarOpen`,hS=200,gS=600,_S=280,vS=()=>{if(typeof window>`u`)return _S;let e=window.localStorage.getItem(pS);if(!e)return _S;let t=Number.parseInt(e,10);return Number.isFinite(t)?Math.min(gS,Math.max(hS,t)):_S},yS=()=>{if(typeof window>`u`)return!0;let e=window.localStorage.getItem(mS);return e===null||e===`true`?!0:e!==`false`};function bS(){let[e,t]=(0,A.useState)(null),[n,r]=(0,A.useState)(0),[i,a]=(0,A.useState)(mt),o=(0,A.useRef)(!1),[s,c]=(0,A.useState)(!0),[l,u]=(0,A.useState)(!0),[d,f]=(0,A.useState)(null),[p,m]=(0,A.useState)(!1),[h,g]=(0,A.useState)(vS),[_,v]=(0,A.useState)(!1),[y,b]=(0,A.useState)(yS),[x,S]=(0,A.useState)(!1),[C,w]=(0,A.useState)(!1),[T,E]=(0,A.useState)(!1),[D,O]=(0,A.useState)(!1),[k,M]=(0,A.useState)(!1),[N,P]=(0,A.useState)(new Set),ee=(0,A.useRef)(!1),F=(0,A.useRef)(null),[I,te]=(0,A.useState)(null),[ne,re]=(0,A.useState)(_t(``,``)),[L,ie]=(0,A.useState)(``),[R,ae]=(0,A.useState)(``),oe=(0,A.useRef)(!1),se=(0,A.useRef)(ne.baseMode);se.current=e?.requestedBaseMode??ne.baseMode;let ce=(0,A.useRef)(ne);ce.current=ne;let le=(0,A.useRef)(0),ue=(0,A.useRef)(null),de=(0,A.useMemo)(()=>!e?.baseCommitish||!e?.targetCommitish?null:_t(e.baseCommitish,e.targetCommitish,e.requestedBaseMode),[e]),fe=(0,A.useMemo)(()=>de?yt(de):null,[de]),{settings:pe,updateSettings:me}=qb(),{isMobile:z,isDesktop:he}=rS(),{threads:ge,addThread:_e,replyToThread:ve,removeThread:ye,removeMessage:be,updateMessage:xe,clearAllComments:Se,applyCommentImports:Ce,generateThreadPrompt:we,generateAllCommentsPrompt:Te}=xx(de?.baseCommitish,de?.targetCommitish,e?.commit,void 0,e?.repositoryId,de?.baseMode),Ee=(0,A.useMemo)(()=>ge.map(e=>({id:e.id,file:e.filePath,line:typeof e.position.line==`number`?e.position.line:[e.position.line.start,e.position.line.end],side:e.position.side,createdAt:e.createdAt,updatedAt:e.updatedAt,codeContent:e.codeSnapshot?.content,messages:e.messages})),[ge]),De=(0,A.useMemo)(()=>aS(Ee.flatMap(e=>e.messages)),[Ee]),Oe=(0,A.useMemo)(()=>{let e=new Map;return Ee.forEach(t=>{let n=e.get(t.file);n?n.push(t):e.set(t.file,[t])}),e},[Ee]),ke=z&&ge.length>0,{viewedFiles:Ae,hasLoadedInitialViewedFiles:B,toggleFileViewed:je,clearViewedFiles:Me}=$x(de?.baseCommitish,de?.targetCommitish,e?.commit,void 0,e?.files,e?.repositoryId,pe.autoViewedPatterns,de?.baseMode);(0,A.useEffect)(()=>{ee.current=!1},[e?.repositoryId,fe,e?.commit]),(0,A.useEffect)(()=>{!ee.current&&B&&(P(new Set(Ae)),ee.current=!0)},[Ae,B]);let{renderedFilePaths:Ne,ensureFileRendered:Pe,ensureFilesRenderedUpTo:Fe,registerLazyFileContainer:Ie,scrollFileIntoDiffContainer:Le}=Qx({diffData:e,diffScrollContainerRef:F,setDiffData:t}),Re=(0,A.useCallback)(async t=>{if(!e)return;let n=e.files.find(e=>e.path===t);if(!n)return;let r=Ae.has(t);await je(t,n),P(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n}),r||setTimeout(()=>{Le(t)},100)},[e,Le,je,Ae]),ze=(0,A.useCallback)(e=>{P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Ve=(0,A.useCallback)(t=>{e&&P(t?new Set(e.files.map(e=>e.path)):new Set)},[e]),He=(0,A.useCallback)(()=>{b(!1)},[]),Ue=(0,A.useCallback)(e=>{o.current=!0,a(e)},[]),{isLoading:We,expandLines:Ge,expandAllBetweenChunks:Ke,prefetchFileContent:qe,getMergedChunks:Je,lastUpdatedAt:Ye}=Tx({baseCommitish:e?.baseCommitish,targetCommitish:e?.targetCommitish,diffIdentity:n}),Xe=(0,A.useRef)(Je);(0,A.useEffect)(()=>{Xe.current=Je},[Je]);let[Ze,$e]=(0,A.useState)(cS),et=(0,A.useMemo)(()=>{let t=new Map;return e?.files.forEach(e=>{t.set(e.path,e)}),t},[e]);(0,A.useEffect)(()=>{if(!e){$e(cS);return}$e(lS(n,Ne,et,e=>Xe.current(e)))},[e,n,et,Ne,Ye]);let tt=(0,A.useMemo)(()=>e?e.files.map(e=>({...e,chunks:uS(Ze,n,e.path)||e.chunks})):[],[e,n,Ze]),[nt,at]=(0,A.useState)(null),{shouldReload:ot,reload:st,watchState:lt}=Ox(async()=>{await Ot()}),{cursor:dt,isHelpOpen:ft,setIsHelpOpen:pt,setCursorPosition:St}=Wx({files:tt,comments:Ee,viewMode:i,reviewedFiles:Ae,onToggleReviewed:Re,onCreateComment:()=>{dt&&at({fileIndex:dt.fileIndex,chunkIndex:dt.chunkIndex,lineIndex:dt.lineIndex})},onCopyAllComments:()=>{ge.length>0&&Mt()},onDeleteAllComments:()=>{ge.length>0&&confirm(`Delete all comments?`)&&Se()},onShowCommentsList:()=>{O(!0)},onRefresh:()=>{st()}});(0,A.useEffect)(()=>{if(!e||!dt)return;let t=e.files[dt.fileIndex]?.path;!t||Ne.has(t)||(Fe(t),requestAnimationFrame(()=>{St(dt)}))},[dt,e,Fe,Ne,St]);let wt=(0,A.useCallback)((e,t,n,r)=>{St({fileIndex:e,chunkIndex:t,lineIndex:n,side:r})},[St]),Tt=(0,A.useCallback)(()=>{at(null)},[at]),Et=(0,A.useCallback)(e=>we(e.id),[we]),Dt=e=>{e.preventDefault(),S(!0);let t=e.clientX,n=h,r=e=>{g(Math.max(hS,Math.min(gS,n+(e.clientX-t))))},i=()=>{S(!1),document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},Ot=(0,A.useCallback)(async e=>{let n=le.current+1;le.current=n,ue.current?.abort();let i=new AbortController;ue.current=i;try{let c=e??(oe.current?ce.current:void 0),l=new URLSearchParams({ignoreWhitespace:String(s)});c?.baseCommitish&&l.set(`base`,c.baseCommitish),c?.targetCommitish&&l.set(`target`,c.targetCommitish),c?.baseMode===`merge-base`&&l.set(`baseMode`,c.baseMode);let u=await fetch(`/api/diff?${l}`,{signal:i.signal});if(!u.ok)throw Error(`Failed to fetch diff data`);let d=await u.json();if(le.current!==n)return;if(t(d),r(e=>e+1),ie(d.baseCommitish&&d.requestedBaseMode!==`merge-base`?d.baseCommitish:``),d.targetCommitish&&ae(d.targetCommitish),!oe.current){let e=d.requestedBaseCommitish??d.baseCommitish,t=d.requestedTargetCommitish??d.targetCommitish;e&&t&&re(_t(e,t,d.requestedBaseMode))}d.mode&&!o.current&&a(ht(d.mode))}catch(e){if(e?.name===`AbortError`||le.current!==n)return;f(e instanceof Error?e.message:`Unknown error`)}finally{ue.current===i&&(ue.current=null),le.current===n&&u(!1)}},[s]);(0,A.useEffect)(()=>{Ot()},[Ot]),(0,A.useEffect)(()=>()=>{ue.current?.abort()},[]),(0,A.useEffect)(()=>{z&&i!==`unified`&&a(`unified`)},[i,z]),(0,A.useEffect)(()=>{try{window.localStorage.setItem(pS,String(h))}catch{}},[h]),(0,A.useEffect)(()=>{try{window.localStorage.setItem(mS,String(y))}catch{}},[y]),(0,A.useEffect)(()=>{fetch(`/api/revisions`).then(e=>e.ok?e.json():null).then(e=>{te(e),e?.resolvedBase&&gt(se.current)!==`merge-base`&&ie(t=>t||e.resolvedBase||``),e?.resolvedTarget&&ae(t=>t||e.resolvedTarget||``)}).catch(()=>te(null))},[]);let kt=(0,A.useCallback)(async e=>{vt(e,ne)||(oe.current=!0,ce.current=e,re(e),u(!0),f(null),await Ot(e))},[Ot,ne]),At=(0,A.useRef)(!1);(0,A.useEffect)(()=>{e?.clearComments&&!At.current&&(At.current=!0,Se({resetAppliedCommentImportIds:!0}),Me(),console.log(`✅ All existing comments and viewed files cleared as requested via --clean flag`))},[e?.clearComments,Se,Me]),(0,A.useEffect)(()=>{!e?.commentImportId||!e.commentImports?.length||Ce(e.commentImports,e.commentImportId).forEach(e=>console.warn(e))},[Ce,e?.commentImportId,e?.commentImports]),(0,A.useEffect)(()=>{e&&(Ae.size<e.files.length?E(!1):Ae.size===e.files.length&&!T&&(w(!0),E(!0),setTimeout(()=>{w(!1)},1e3)))},[Ae.size,e,T]),(0,A.useEffect)(()=>{let e=JSON.stringify({threads:Ee});fetch(`/api/comments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:e}).catch(e=>{console.error(`Failed to sync comments:`,e)});let t=()=>{navigator.sendBeacon(`/api/comments`,e)};return window.addEventListener(`beforeunload`,t),()=>{window.removeEventListener(`beforeunload`,t)}},[Ee]),(0,A.useEffect)(()=>{let e=new EventSource(Dx(`/api/heartbeat`));return e.onopen=()=>{console.log(`Connected to server heartbeat`)},e.onerror=()=>{console.log(`Server connection lost`),e.close()},()=>{e.close()}},[]);let jt=(0,A.useCallback)((e,t,n,r,i)=>(_e({filePath:e,body:n,side:i||`new`,line:typeof t==`number`?t:{start:t[0],end:t[1]},codeSnapshot:r?{content:r,language:void 0}:void 0}),Promise.resolve()),[_e]),Mt=async()=>{try{await Ct(Te()),m(!0),setTimeout(()=>m(!1),2e3)}catch(e){console.error(`Failed to copy all comments prompt:`,e)}},Nt=(0,A.useCallback)((e,t)=>(ve({threadId:e,body:t}),Promise.resolve()),[ve]),Ft=t=>{if(!e)return;let n=sS(t,e.files);n&&St(n)},It=(0,A.useCallback)(async(e,t)=>{try{let n=await fetch(`/api/open-in-editor`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:e,line:t,editor:pe.editor})});if(!n.ok){let e=await n.json().catch(()=>null),t=n.statusText;e&&typeof e==`object`&&`error`in e&&typeof e.error==`string`&&(t=e.error),console.error(`Failed to open file in editor:`,t)}}catch(e){console.error(`Failed to open file in editor:`,e)}},[pe.editor]),Lt=e=>{St(null);let t=e.target,n=t.closest(`[data-comment-button="true"]`),r=t.closest(`[data-open-in-editor-button="true"]`);!n&&!r&&Rt(e)},Rt=e=>{document.querySelectorAll(`form[data-empty="true"]`).forEach(t=>{t.contains(e.target)||t.querySelector(`button[type="button"]`)?.click()})};if(l)return(0,j.jsx)(`div`,{className:`flex items-center justify-center h-screen bg-github-bg-primary`,children:(0,j.jsx)(`div`,{className:`text-github-text-secondary text-base`,children:`Loading diff...`})});if(d)return(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-screen bg-github-bg-primary text-center gap-2`,children:[(0,j.jsx)(`h2`,{className:`text-github-danger text-2xl mb-2`,children:`Error`}),(0,j.jsx)(`p`,{className:`text-github-text-secondary text-base`,children:d})]});if(!e)return(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-screen bg-github-bg-primary text-center gap-2`,children:[(0,j.jsx)(`h2`,{className:`text-github-danger text-2xl mb-2`,children:`No data`}),(0,j.jsx)(`p`,{className:`text-github-text-secondary text-base`,children:`No diff data available`})]});let zt=pe.editor!==`none`&&e.openInEditorAvailable!==!1;return(0,j.jsx)(Pt,{children:(0,j.jsxs)(`div`,{className:`h-screen flex flex-col`,onClickCapture:Lt,children:[(0,j.jsxs)(`header`,{className:`bg-github-bg-secondary border-b border-github-border flex ${z?`flex-col`:`flex-row items-center`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between w-full ${z?`px-3 py-2 gap-3`:`px-4 py-3 gap-4 w-auto`} ${x?``:`!transition-all !duration-300 !ease-in-out`}`,style:{width:z?`100%`:y?`${h}px`:`auto`,minWidth:z?`0px`:y?`200px`:`auto`,maxWidth:z?`none`:y?`600px`:`none`},children:[(0,j.jsx)(`h1`,{children:(0,j.jsx)(pb,{style:{height:`18px`,color:`var(--color-github-text-secondary)`}})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`button`,{onClick:()=>b(!y),className:`p-2 text-github-text-secondary hover:text-github-text-primary hover:bg-github-bg-tertiary rounded transition-colors`,title:y?`Collapse file tree`:`Expand file tree`,"aria-expanded":y,"aria-controls":`file-tree-panel`,"aria-label":`Toggle file tree panel`,children:y?(0,j.jsx)(rt,{size:18}):(0,j.jsx)(it,{size:18})}),(0,j.jsx)(`button`,{onClick:()=>v(!0),className:`p-2 text-github-text-secondary hover:text-github-text-primary hover:bg-github-bg-tertiary rounded transition-colors`,title:`Settings`,children:(0,j.jsx)(ct,{size:18})})]})]}),!z&&(0,j.jsx)(`div`,{className:`border-r border-github-border ${x?``:`!transition-all !duration-300 !ease-in-out`}`,style:{width:y?`4px`:`0px`,height:`calc(100% - 16px)`,margin:`8px 0`,transform:`translateX(-2px)`}}),(0,j.jsxs)(`div`,{className:`flex-1 flex flex-wrap items-center justify-between ${z?`px-3 pb-2 gap-3`:`px-4 py-3 gap-4`}`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center ${z?`gap-2`:`gap-3`}`,children:[!z&&(0,j.jsxs)(`div`,{className:`flex bg-github-bg-tertiary border border-github-border rounded-md p-1`,children:[(0,j.jsxs)(`button`,{onClick:()=>Ue(`split`),className:`px-3 py-1.5 text-xs font-medium rounded transition-all duration-200 flex items-center gap-1.5 cursor-pointer ${i===`split`?`bg-github-bg-primary text-github-text-primary shadow-sm`:`text-github-text-secondary hover:text-github-text-primary`}`,children:[(0,j.jsx)(Be,{size:14}),`Split`]}),(0,j.jsxs)(`button`,{onClick:()=>Ue(`unified`),className:`px-3 py-1.5 text-xs font-medium rounded transition-all duration-200 flex items-center gap-1.5 cursor-pointer ${i===`unified`?`bg-github-bg-primary text-github-text-primary shadow-sm`:`text-github-text-secondary hover:text-github-text-primary`}`,children:[(0,j.jsx)(ut,{size:14}),`Unified`]})]}),(0,j.jsx)(bt,{checked:s,onChange:c,label:`Ignore Whitespace`,title:s?`Show whitespace changes`:`Ignore whitespace changes`}),(0,j.jsx)(mb,{shouldReload:ot,isReloading:lt.isReloading,onReload:st,changeType:lt.lastChangeType,compact:z})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center text-sm text-github-text-secondary ${z?`gap-3`:`gap-4`}`,children:[!z&&ge.length>0&&(0,j.jsx)(xt,{commentsCount:ge.length,isCopiedAll:p,onCopyAll:Mt,onDeleteAll:Se,onViewAll:()=>O(!0)}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1 items-center`,children:[(0,j.jsxs)(`div`,{className:`text-xs relative`,children:[Ae.size===e.files.length?`All diffs difit-ed!`:`${Ae.size} / ${e.files.length} files viewed`,(0,j.jsx)(Gb,{isActive:C})]}),(0,j.jsx)(`div`,{className:`relative h-2 bg-github-bg-tertiary rounded-full overflow-hidden`,style:{width:`90px`,border:`1px solid var(--color-github-border)`},children:(0,j.jsx)(`div`,{className:`absolute top-0 right-0 h-full transition-all duration-300 ease-out`,style:{width:`${(e.files.length-Ae.size)/e.files.length*100}%`,backgroundColor:(()=>{let t=(e.files.length-Ae.size)/e.files.length*100;return t>50?`var(--color-github-accent)`:t>20?`var(--color-github-warning)`:`var(--color-github-danger)`})()}})})]}),I?(0,j.jsx)(rc,{options:I,selection:ne,resolvedBaseRevision:L,resolvedTargetRevision:R,onSelectDiff:e=>void kt(e),onOpenAdvanced:()=>M(!0),compact:!he}):(0,j.jsxs)(`span`,{className:`text-xs`,children:[`Reviewing:`,` `,(0,j.jsx)(`code`,{className:`bg-github-bg-tertiary px-1.5 py-0.5 rounded text-xs text-github-text-primary`,children:e.commit.includes(`...`)?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`text-github-text-secondary font-medium`,children:[e.commit.split(`...`)[0],`...`]}),(0,j.jsx)(`span`,{className:`font-medium`,children:e.commit.split(`...`)[1]})]}):e.commit})]})]})]})]}),I&&(0,j.jsx)(_b,{isOpen:k,onClose:()=>M(!1),options:I,selection:ne,resolvedBaseRevision:L,resolvedTargetRevision:R,onApply:e=>void kt(e)},k?yt(ne):`closed`),z&&y&&(0,j.jsx)(`button`,{type:`button`,"aria-label":`Close file tree`,className:`fixed inset-0 bg-black/40 z-30`,onClick:()=>b(!1)}),(0,j.jsxs)(`div`,{className:`flex flex-1 overflow-hidden relative`,children:[(0,j.jsx)(`div`,{className:`relative overflow-hidden ${x?``:`!transition-all !duration-300 !ease-in-out`}`,style:{width:z?`0px`:y?`${h}px`:`0px`},children:(0,j.jsxs)(`aside`,{id:`file-tree-panel`,className:`bg-github-bg-secondary overflow-y-auto flex flex-col ${z?`fixed inset-y-0 right-0 z-40 w-[min(85vw,360px)] border-l border-github-border transition-transform duration-300 ease-out`:`relative border-r border-github-border`}`,style:{width:z?`min(85vw, 360px)`:`${h}px`,minWidth:z?`0px`:`200px`,maxWidth:z?`none`:`600px`,height:`100%`,transform:z?y?`translateX(0)`:`translateX(100%)`:void 0},children:[(0,j.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,j.jsx)(ub,{files:e.files,onScrollToFile:Le,onFileSelected:z?He:void 0,comments:Ee,reviewedFiles:Ae,onToggleReviewed:Re,selectedFileIndex:dt?.fileIndex??null})}),!z&&(0,j.jsxs)(`div`,{className:`p-4 border-t border-github-border flex justify-between items-center`,children:[(0,j.jsxs)(`button`,{onClick:()=>pt(!0),className:`flex items-center gap-1.5 text-github-text-secondary hover:text-github-text-primary transition-colors`,title:`Keyboard shortcuts (Shift+?)`,children:[(0,j.jsx)(Qe,{size:16}),(0,j.jsx)(`span`,{className:`text-sm`,children:`Shortcuts`})]}),(0,j.jsxs)(`a`,{href:`https://github.com/yoshiko-pg/difit`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-github-text-secondary hover:text-github-text-primary transition-colors`,title:`View on GitHub`,children:[(0,j.jsx)(`span`,{className:`text-sm`,children:`Star on GitHub`}),(0,j.jsx)(db,{style:{height:`18px`,width:`18px`}})]})]})]})}),!z&&(0,j.jsx)(`div`,{className:`bg-github-border hover:bg-github-text-muted cursor-col-resize ${x?``:`!transition-all !duration-300 !ease-in-out`}`,style:{width:y?`4px`:`0px`},onMouseDown:Dt,title:`Drag to resize file list`}),(0,j.jsx)(`main`,{ref:F,className:`flex-1 overflow-y-auto ${ke?`pb-16`:``}`,children:e.files.map((t,r)=>{let a=Oe.get(t.path)??dS,o=uS(Ze,n,t.path)??fS,s=Ne.has(t.path);return(0,j.jsx)(`div`,{id:qx(t.path),"data-file-path":t.path,"data-rendered":s?`true`:`false`,ref:e=>Ie(t.path,e),className:`mb-6`,children:s?(0,j.jsx)(nb,{file:t,threads:a,showAuthorBadges:De,diffMode:i,reviewedFiles:Ae,onToggleReviewed:Re,collapsedFiles:N,onToggleCollapsed:ze,onToggleAllCollapsed:Ve,onAddComment:jt,onGenerateThreadPrompt:Et,onRemoveThread:ye,onReplyToThread:Nt,onRemoveMessage:be,onUpdateMessage:xe,onOpenInEditor:zt?It:void 0,syntaxTheme:pe.syntaxTheme,baseCommitish:e.baseCommitish,targetCommitish:e.targetCommitish,cursor:dt?.fileIndex===r?dt:null,fileIndex:r,onLineClick:wt,commentTrigger:nt?.fileIndex===r?nt:null,onCommentTriggerHandled:Tt,mergedChunks:o,expandLines:Ge,expandAllBetweenChunks:Ke,prefetchFileContent:qe,isExpandLoading:We}):(0,j.jsx)(`div`,{className:`bg-github-bg-secondary border border-github-border rounded-md px-4 py-3`,children:(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-github-text-muted`,children:`Deferred Rendering`}),(0,j.jsx)(`div`,{className:`text-sm font-mono text-github-text-primary truncate`,children:t.path})]}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>Pe(t.path),className:`px-3 py-1.5 text-xs rounded border border-github-border text-github-text-secondary hover:text-github-text-primary hover:bg-github-bg-tertiary`,children:`Load now`})]})})},t.path)})})]}),ke&&(0,j.jsx)(`div`,{className:`fixed bottom-0 left-0 right-0 z-20 bg-github-bg-secondary border-t border-github-border px-4 py-2 flex justify-end`,children:(0,j.jsx)(xt,{commentsCount:ge.length,isCopiedAll:p,onCopyAll:Mt,onDeleteAll:Se,onViewAll:()=>O(!0),direction:`up`,compact:!0})}),_&&(0,j.jsx)(Ub,{isOpen:_,onClose:()=>v(!1),settings:pe,onSettingsChange:me}),(0,j.jsx)(fb,{isOpen:ft,onClose:()=>pt(!1)}),(0,j.jsx)(dr,{isOpen:D,onClose:()=>O(!1),onNavigate:Ft,comments:Ee,showAuthorBadges:De,onRemoveThread:ye,onGenerateThreadPrompt:Et,onReplyToThread:Nt,onRemoveMessage:be,onUpdateMessage:xe,syntaxTheme:pe.syntaxTheme})]})})}var xS=document.getElementById(`root`);if(!xS)throw Error(`Root element not found`);k.createRoot(xS).render((0,j.jsx)(A.StrictMode,{children:(0,j.jsx)(_e,{initiallyActiveScopes:[`navigation`],children:(0,j.jsx)(bS,{})})}));